Questions tagged [cron]

Cron is a job scheduler that allows users to run commands periodically.

Filter by
Sorted by
Tagged with
0
votes
1answer
37 views

crontab cannot find environment variable even after sourcing .bashrc

crontab -e 00 00 * * * /home/username/run.sh >> /home/username/log 2>&1 Inside run.sh: source /home/username/.bashrc java When crontab job is triggered, I got this error in the log: /...
0
votes
1answer
16 views

CentOS 7 cron jobs

/etc/crontab is empty yet cron jobs are still being run. scripts that are located in /etc/cron.hourly, /etc/cron.daily, etc. are still being run. So where is the master if it's not /etc/crontab? Is ...
1
vote
2answers
31 views

Cron task does not work

I am developing a backup script in my NAS running a docker container. Inside my container I have cron running with this /etc/crontab: root@backups-nas:/code# cat /etc/crontab SHELL=/bin/bash PATH=/...
0
votes
1answer
38 views

Running a Python script using Crontab

I've written a python script which works well when I run it as python3 /path/to/file/Script.py, but once I try to run it through crontab it doesn't work as intended. My script is supposed to download ...
1
vote
1answer
32 views

crontab.service file not found despite installed and configured crontab

I want to set up crontab every minute on Manjaro, so I've put some script every minute with: $ crontab -e * * * * * /path/to/my/script.sh crontab: installing new crontab Then I see it is installed $...
0
votes
0answers
25 views

WSL Run Service at Start

I'm honestly not sure if this is an issue with WSL or I'm just doing something wrong for Ubuntu in general, but I cannot get the cron service to run at start on my WSL system. It starts just fine ...
0
votes
1answer
46 views

How to redirect output to a log file from cron and prepend timestamp?

Most logs on my Mac have a time stamp before the output message like this: Nov 14 17:55:24 - SoftRAID Driver: SoftRAID driver loaded, version 5.8.1. I am running an executable in cron and instead of ...
2
votes
0answers
20 views

Shutdown from a script executed by cron as root

Background I'm trying to write a script (see end of the question) that checks the temperature on Raspberry PI and shuts it down automatically if it goes too high. The script would be run by cron, ...
0
votes
1answer
27 views

how to schedule a task that runs a command or script when a user logs on?

I want to program a script that is launched whenever a specific user, let's call it user log in. For example, when you log on to the computer with that user or using the su command on a terminal. I ...
0
votes
1answer
38 views

Cron job: echo 3 > /proc/sys/vm/drop_caches not actualy being written to /proc/sys/vm/drop_caches

I have this script: #!/bin/bash # If the cache is greater than 5G, echo 3 > /proc/sys/vm/drop_caches CACHE=`grep -w "Cached" /proc/meminfo | awk '{ print $2 }'` if [[ $CACHE -gt 5000000 ]] then ...
1
vote
1answer
49 views

How to remove cron task that deletes PHP sessions

It seems Linux Mint 19.3 Tricia Cinnamon wants to clear out PHP session files every half-hour. How do I: Remove this task from the scheduler's awareness, and Not have to reboot the computer to do so....
2
votes
1answer
45 views

Crontab does not accept 2/6 on hour [duplicate]

This setting, for every six hours, works fine 0 */6 * * * But this runs every six hours at 0:00, 6:00, 12:00 and 18:00 Now I want to run every six hours, but starting at 2:00. I read on this ...
0
votes
1answer
23 views

cron job setup using rpm is not working

I've below cron file SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin LOG_DIR=/var/log/myapp-services-cron MYAPP_SERVICES_DIR=/opt/myorg/apps/myapp-services * * ...
0
votes
1answer
37 views

Running a python script encapsulated in a bash function via cron

I have a python script that I've encapsulated in a bash function. I would like to be able to call this function as a cron job, but I cannot seem to get cron to execute it. The function is as follows: ...
0
votes
0answers
21 views

Linux Heartbeat for cron and services

I have few vital scripts that run using cron and some other are services. In past experiences we have broken those scripts by mistake and I was wondering if there is some sort of 'Heartbeat' that ...
0
votes
0answers
17 views

Is adding crontabs safe if it's done via a multithreadded application like a web server?

I'm using cronjobs to send email reminders to my clients. What happens is that when an email is first sent to a user, a reminder is scheduled at the same time by adding a cronjob for it using this ...
0
votes
0answers
16 views

Why does my cron job spawn multiple processes?

I'm fairly new at using cron jobs. I'm using Webmin to create the cron job as shown here The actual command I'm running is ffmpeg -y -i rtsp://xxx:xxx@xxx.org:8127/live -vframes 1 /var/www/html/...
2
votes
0answers
46 views

CentOS 7, cronjob for user does not run script

I have CentOS 7.6 on a virtual machine. there some bash script at /opt which i need to run them with this user dbuser. these scripts write their output in a folder. Using crontab -e I put these in ...
0
votes
0answers
36 views

Different versions of files in different hours

On my laptop, I have three files: file, file-morning and file-afternoon. I want file to be a copy of file-morning before 12AM and a copy of file-afternoon after 12AM. Ideally, I would like to be able ...
0
votes
1answer
31 views

Crontab doesn't find a word

sid="GR1" if sapcontrol -prot PIPE -nr $sid -prot PIPE -function GetSystemInstanceList | grep 'GRAY' >> $LOGFILE then echo "STATE: SAP system is offline. (sapcontrol)" >> $...
0
votes
1answer
132 views

Crontab command missing in Fedora 31

Probably a ridiculously simple question, but I cannot find a thing on this online. I am using vagrant boxes for several tests and in this particular case it is the Fedora 31 box from Bento with ...
0
votes
1answer
41 views

Cron create crontab as user, not as root

On Ubuntu I want to set up cron task to send email from my application. I think that I should run this crontab as user, not as root. Am I right? But I cannot go to the crontabs directory. I have ...
0
votes
1answer
46 views

Configuring cron from shell script

I have a shell script with the following lines (the full script at the end of post): CRON_BCK_CMD=/home/user/bck.sh CRON_CONF=" */30 * * * * $CRON_BCK_CMD" but when I simply run these in ...
0
votes
0answers
81 views

How to restart Cinnamon after screen unlock

I have an issue with Cinnamon that manifests itself after a long idle period, when I use the computer after a few hours of idle, the CPU, memory, etc. all seem to be fine for Cinnamon, but every ...
0
votes
1answer
39 views

Executing hourly / weekly task with crontab

I want to execute a task using cron once per week or once per hour, but not starting until a given time. If it was a daily task I would write simply this (after crontab -e). 00 07 * * * ...
0
votes
3answers
53 views

How to comment all the crontab entries and then uncomment same using a script

Just to be clear I want to comment crontab entries, not a basic file. Usually, I do it like crontab -e 30 * * * * /u01/app/abccompny/scripts/GenerateAWRReport.pl 01,31 * * * * /u01/app/abccompny/...
0
votes
1answer
50 views

crontab -e doesnt shows option to select editor - what to do?

I'm using Linux Centos 7, as a non-root user. When I want to add cron job that is not possible, I enter crontab -e I don't have option to select editor or to add cron job, just have blue ~ signs?? ...
0
votes
0answers
42 views

can't create your crontab file in the crontab directory

OS: Solaris 5.11 Until today, I was able to populate the crontab using: crontab myjobs.dat In fact, I have a shell script that executes this so that I can refresh crontab. I've also used echo > ...
0
votes
0answers
34 views

crontab modification is not permanent

I am a below avg linux users, so my question may be basic to most of you guys. When I use crontab -e, the changes I do do no last. If I add a line, it is not there the next day. Perhaps there is a ...
0
votes
0answers
24 views

“Time Blocks” with Cron

I don't know the technical name for this but I am looking for the following behaviour: Define a daily time block (e.g. 9am to 5pm) with an associated action If this time block is entered while the ...
0
votes
1answer
210 views

cron automatically activated after some time

I am working on Ubuntu remote server. I deleted automatic cron jobs from my server, but it recovered automatically after some days and occupy my 50% CPU. I attached cron job file from my server here (...
1
vote
1answer
24 views

`systemctl hibernate` not executed on crontab script

I have a script that verifies the battery level using acpi and if it's below certain threshold it should lock the machine and hibernate. The script is executed every minute using crontab The problem ...
-1
votes
2answers
68 views

When is /etc/crontab checked?

I read on cron man page: Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; The found crontabs are loaded into the memory. Cron also searches ...
1
vote
1answer
70 views

Cron runs a non-existing variant of . sh script

I've been encountered a strange phenomena. I've been messing with cron, so it runs a script called startup.sh, which it does. I used the command sudo crontab -e and then entered the following: @...
0
votes
3answers
56 views

Search string and add # to the beginning of that line

Need some help using the vi editor. I am trying to comment out a line on crontab for a specific user. This is the line on the crontab among many other lines: 0,5,10,15,20,25,30,35,40,45,50,55 2-...
0
votes
1answer
42 views

Is it possible to run crontab when a button on my custom website is triggered

I want to make many tasks(different shell script) run with crontab by clicking on a button on website to start all tasks specified in crontab. Is it possible to do this? Please provide me the ...
1
vote
0answers
71 views

Script will run in root terminal but not when run as a cronjob as a user

The cron job: 51 18 * * * /home/XXXXXX/public_html/wp-content/uploads/wpallimport/files/wpai_scripts/ld_wpai_script 2>> /home/XXXXXX/public_html/wp-content/uploads/wpallimport/files/...
0
votes
3answers
64 views

echoing Command to cron.d

I am trying to append/echo a command to cron.d. However, when running the script that echoes the command: echo */2 * * * * /usr/bin/aws ssm-send-command --document-name "AWS-RunShellScript" --...
0
votes
1answer
115 views

What is the different use case of cronie, cronie-noanacron, cronie-anacron?

Today (in 2020, with init systemd), there seem to be many ways to schedule tasks (something I assume previously made by the crond daemon). My trouble is to understand why there are three packages ...
0
votes
0answers
34 views

Linux: OpenSuse: Cron/Postfix: Change sender name with MAILFROM

when I get output from a cron job on OpenSuse, it has always this format in "From" Header: "(Cron Daemon)" <user@hostname.domain> I figured out how to change the "user" and the "hostname....
1
vote
0answers
69 views

Cron jobs not running on Kubernetes + Alpine linux

I am trying to run a cron job on Alpine Linux docker image which is then pushed in Kubernetes container. The Cron job is that I want the container to restart itself after every 15 mins. So my command ...
0
votes
1answer
172 views

What is the best practice of running cron job in a docker container

My application is a Python Django running on a docker container.This application has a cron job that keeps updating the data in a database. Should I put this cron job into a separate container because ...
0
votes
1answer
36 views

What is the $PATH given to cron jobs? [duplicate]

I have a process that runs on a @reboot cron job. The process needs to run an executable file. I have noticed that I have to put the executable in /usr/bin/. I can't just put it in a folder in my $...
1
vote
1answer
81 views

Cronjobs not running. Cron daemon not working

First of all, the server specs: VPS - OpenVZ, Ubuntu 14, Kernel 3.10 Now, it appears that the cron daemon is not running ANY crojobs at all and i cannot find out why. I tried: Rebooting the server....
0
votes
1answer
48 views

Cannot logrotate hourly by cron

I have the following entry in /etc/crontab 47 * * * * root /usr/sbin/logrotate -v -f /etc/logrotate.d/mariadb_dumps &> /tmp/errrot The line is run because the /tmp/errrot if created (empty), ...
-1
votes
1answer
51 views

openSUSE: “Permission denied” error on Cron log file

using: openSUSE Leap 42.2 /etc/cron.d/mysite file content: * * * * * wwwrun /usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1 /etc/cron.d/ dir content: /etc/...
0
votes
1answer
75 views

Unable to send notifications from cron job

I'm trying to use a cron job to see when the battery gets lower than a given threshold, and then to send a battery critical notification. However, when I make the cron job execute a script every ...
0
votes
0answers
33 views

How can I schedule a nightly reboot?

I'm having some periodic issues running a particular application. I know a scheduled reboot is NOT the answer but until I can figure out the problem I need to schedule a reboot each morning. Any ...
0
votes
1answer
132 views

cron not running in Ubuntu 18.04.3 LTS

I have created downloads file inside /etc/cron.d/ directory. Following is the content of the downloads file. * * * * * root /usr/bin/python3 /path/python.py File permissions and owner: -rw-r--r-- ...
1
vote
0answers
71 views

Comfortable way to keep Debian Buster up to date?

So far I have only used Debian (and other Linux distributions based on Debian) for testing purposes and on non-productive systems. On these systems, I occasionally carried out updates manually via the ...

1
2 3 4 5
37