Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cron]

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

1
vote
1answer
127 views

Separate server's hostname appearing in this server's cron logs

I get entries like these in /var/log/cron, in a host named SERV2 (RHEL 6.2): Apr 21 14:50:01 SERV1 CROND[14799]: (root) CMD (/usr/lib64/sa/sa1 -S DISK 1 1) Apr 21 15:20:01 serv2 CROND[24438]: (root) ...
1
vote
1answer
241 views

Get the process start time irrespective of NTP updates

I'm trying to record the start time of a process kicked off by an @reboot cronjob. I'm using ps -p $$ -o ltime= presently, but I've run into a catch. My machine (a Raspberry Pi) connects to the ...
1
vote
2answers
1k views

cron will find certain commands on the PATH but not others

Having issues making crontab run certain commands, despite the PATH and SHELL being set correctly. Here is the env of the machine: SHELL=/bin/bash USER=ubuntu MAIL=/var/mail/ubuntu PATH=/usr/local/...
1
vote
4answers
234 views

How can I find out cron implementation on Ubuntu?

Wikipedia says With the advent of the GNU Project and Linux, new crons appeared. The most prevalent of these is the Vixie cron, originally coded by Paul Vixie in 1987. Version 3 of Vixie cron ...
1
vote
1answer
83 views

When a cronjob really starts?

My question comes from an observation that I made while seeing an every minute cronjob running like that: 12:00:15 (cron started) 12:01:20 (cron started) 12:02:02 (cron started) . . . As it seems ...
1
vote
1answer
265 views

BAD FILE MODE yum-cron

Content of service crond status -l: [root@test ~]# service crond status -l Redirecting to /bin/systemctl status -l crond.service ● crond.service - Command Scheduler Loaded: loaded (/usr/lib/systemd/...
1
vote
3answers
806 views

add text on line before match

Trying to add text on the line before that it find the match (updateKey.sh) in this case, but won't get it to work. Here is my crontab file that the script adds the line to 0 06,18 * * * /home/server/...
1
vote
0answers
90 views

editing files at the same time when cron automatically runs backup

I heard that it is a good idea to schedule backup in crontab file. I also head that it is bad to edit files while they are backed up. It may happen that cron stats to backup a directory while I am ...
1
vote
1answer
1k views

Using cron to start a process on a terminal without using screen?

I want to start a process in a terminal using cron. I want the process to start in a terminal, so that I can continuously see the output of the process on the terminal, and kill it / restart it etc. I ...
1
vote
1answer
248 views

Why is my cron job not scheduled?

I am trying to set up a cron job, by creating a file /etc/cron.d/myjob: 55 * * * * t echo hello > /tmp/cron.log && cd /tmp/test/ && pwd > /tmp/cron.log I tried to verify if ...
0
votes
3answers
537 views

My cron job doesn't run

I set up to run notify-send every minute, $ crontab -l 1 * * * * /usr/bin/notify-send -t 0 "hello" Why does it not work? Do I need to restart OS after editing the crontab file? Does the following ...
0
votes
1answer
467 views

problem with cron job for every 2 minutes

I have a cron job for very 2 min and somebody told me that some servers do not allow 2 min cron jobs. basically from 30 min. it is true?
0
votes
2answers
251 views

Shutdown when not in use during a certain time

I have a "media center" PC that sometimes I forget to shut down at night. If I remember, I'll usually remote into my "media center" PC and shut it down, but most nights I forget to do it and the PC ...
0
votes
1answer
1k views

Find time it took to run a cron job?

Normally I don't post questions which are trying to get advice on how to directly a question in a textbook but in this case I feel it is necessary. The last questions said to write a C program and ...
0
votes
1answer
57 views

why does the cron daemon make efforts about recording output when executing a cron job, instead of using redirection inside the job?

The manpage of cron says When executing commands, any output is mailed to the owner of the crontab (or to the user specified in the MAILTO environment variable in the crontab, if such ...
0
votes
2answers
945 views

Can I manually create and edit `/var/spool/cron/crontabs/t` without `crontab -e`?

I heard that /etc/crontab and /etc/cron.d/* can only be edited manually without crontab command from How would you edit `/etc/crontab` and files under `/etc/cron.d/?. Do I need to run crontab -e to ...
0
votes
1answer
12k views

How do I know if crontab is working fine?

Is there a log of crontab for me to know if crontab is working fine? I am on Linux Mint 17.3. What I have done: ran crontab -e as root it did not exist, so I chose nano editor and proceeded entered ...
0
votes
2answers
530 views

How to prove that the interpreter is /bin/bash when called from cron

That has been a bit of a puzzle for me. When I try the following cronjobs individually: * * * * * /bin/bash -c "readlink /proc/$$/exe >> /root/printenv" * * * * * /bin/bash -c "readlink /proc/$...
0
votes
4answers
1k views

How to use gnome-session-save from cron?

I am trying to issue the gnome-session-save --kill command via crontab. I used the command sudo crontab -e. In the file is this: PATH=/usr/bin 00 00 * * * gnome-session-save --kill The command does ...
0
votes
2answers
280 views

Auto Delete Inactive files after x

Is there a way I could delete certain folders after x amount of days of inactivity? I was thinking of using cron but that wouldn't take the inactivity part into consideration. Is there any Debian ...
0
votes
1answer
122 views

In what cases will anacron not run?

I am trying to understand how anacron works (in Fedora). I have three related questions. I am confused because of the following statement from the anacrontab manual: The START_HOURS_RANGE variable ...
0
votes
1answer
232 views

/var/lib/logrotate/status gets invalid entries

We are seeing our /var/lib/logrotate/status gets invalid entries like following: saurabh@1236:~$ cat /var/lib/logrotate/status logrotate state -- version 2 "/var/log/syslog" 2018-3-13 "/var/log/auth....
0
votes
1answer
282 views

CRON path problems

I have a Python script that runs from the command line beautifully, but when I try and run it from CRON does strange things. The script generates, then runs an apk script file. The apk script file ...
0
votes
2answers
3k views

Cron job which runs every 5 seconds

I need to create an cron job with the following functionality: The job should go to a particular directory and touch one file every 5 seconds. It should run for only 1 minute. The logic is to ...
0
votes
1answer
223 views

Cron job for 7 days alone not followed by multiple weeks

I need to execute a cronjob to run once for 7 days alone. I have tried like this: 0 0 * * 0-6 myscript.sh It gets run for once a day and running every day of the week since I gave as 0-6. But I ...
0
votes
1answer
95 views

Does this script run a program once as close as to every 15 seconds and not run two instances at the same time?

In https://unix.stackexchange.com/a/11105/674, Gilles wrote The following crontab line will start some_job every 15 seconds. * * * * * for i in 0 1 2; do some_job & sleep 15; done; some_job ...
0
votes
1answer
141 views

cron reschedule seems not to be taken into account unless reboot occurs?

I have read a number of posts on SE.com regarding cronjobs, crontab, and how to reschedule cron jobs. But it seems that, in my Debian environment, a session cleanup job schedule simply called "php", ...
0
votes
1answer
59 views

Does cron modify execution environment and make tor servce not change exit node?

According to https://unix.stackexchange.com/a/478636/674, cron modifies the execution environment to execute a job. When I run sudo service tor reload twice directly in bash, it always shows two ...
0
votes
2answers
378 views

cron job not redirect the output to file [duplicate]

I set the following line in cron job under /etc/cron.d/find_old_file * * * * * root [[ -d /var/log/ambari-metrics-collector ]] && find /var/log/ambari-metrics-collector -type f -mtime +10 ...
0
votes
3answers
611 views

Lock folder when running cron

I am setting up my first cron on a Ubuntu Desktop system. I was curious to know if there is a way to lock a folder before a cron is ran and how to set it up? I am following this article. I am just ...
0
votes
1answer
249 views

Cleaning out mail folders with cron task

SpamAssassin has a feature to "learn" spam. Each user has a .spam folder in their mail folder and they will be instructed to move any spam into that folder. (Users are using IMAP.) I have set up a ...
0
votes
1answer
61 views

cron not executing

i have a cron in my crontab 45 18 * * * root /bkp_db.sh but it is not working. it is not being executed. what im doing wrong? Inside my script: NOW=$(date +"%Y-%m-%d") mysqldump -u root apps_db &...
0
votes
1answer
457 views

How to troubleshoot failing cron job

I have a crontab root file that looks like this: lab-1:/var/www/cdd# crontab -l # do daily/weekly/monthly maintenance # min hour day month weekday command * * * * *...
0
votes
2answers
823 views

Problem using ssh with crontab

I need to establish a permanent ssh tunnel between private server behind firewall and a public server so that I can ssh into private server anytime via the public server. When I manually execute this ...
-2
votes
2answers
330 views

Is it true that “cron.daily runs anacron everyhour”?

On Ubuntu, what is the calling relation between cron and anacron? I am confused by looking at /etc/anacrontab, /etc/cron.daily/0anacron and /etc/crontab. From https://askubuntu.com/a/848638/1471 ...