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

learn more… | top users | synonyms (1)

2
votes
1answer
27 views

How can I pass a filename containing percent signs (%) as a parameter to a shell script in cron?

We have currently setup a cron job for our new script as below: 46 22 * * * /gzm_common/diagbat9/global/prod/chgstatus.sh /backups/diagbat9/Demantra/output/SK_ITEM_EXTRACT_MFGPRO_$(date +%m%d%y).txt ...
0
votes
2answers
17 views

confuse about User:Group what is the best for /var/www, and Crontab user?

I'm new on linux server. I have 2 question that I'm confuse about this. 1 1. user:group now I chown my /var/www/html like this. my nginx.conf is set server{ user www-data } and in terminal I set ...
0
votes
1answer
32 views

Changing crontab with sed [on hold]

Can you please tell me what is missing in the following sed? I am trying to change cron pattern. crontab -l | sed 's/jj-0.1/jj-0.1.1/g'
0
votes
2answers
29 views

How to set cron job for system

I'm really new on Linux and have no any previous experience on it. And I opened this account to ask this question. I need to install a cron job I've followed the short guide here. Well, I think it ...
1
vote
1answer
83 views

Reboot when no network connection does not work!

I have a Raspberry Pi that I use as a NAS for my local network. It works fine, but when I turn off the router to which the pi is connected, it permanently loses the connection. To be able to connect ...
1
vote
2answers
41 views

crontab error with (No MTA installed) but I use >/dev/null 2>&1

I'm new on linux user I try to run crontab to backup my database with vagrant user * * * * * /usr/bin/mysqldump -h localhost -u root -p root mydb | gzip > /var/backup/all/database_`date ...
1
vote
0answers
18 views

systemctl to start cron-like job

In /etc/systemd/system directory I have: rsnapshot-backup.service file, with following content: [Unit] Description=rsnapshot backup automation [cron like] [Service] Nice=19 IOSchedulingClass=2 ...
0
votes
1answer
38 views

How to start a cron task?

It sounds really simple, but many times I was stuck at the beginning of learning a new command. The tutorial writer think it's natural to start, but it's not. This is the tutorial I've been reading: ...
0
votes
1answer
30 views

What should be the security context of these cron files?

I am running Fedora 20 and I am having some issues when running logrotate and anacron which I suspect may be related to SELinux: Failed to determine timestamp: Cannot assign requested address chgrp: ...
14
votes
3answers
916 views

How can I start a cronjob 1 hour later each day?

I need to start a cronjob every day, but an hour later each day. What I have so far works for the most part, except for 1 day of the year: 0 0 * * * sleep $((3600 * (10#$(date +\%j) \% 24))) ...
0
votes
1answer
28 views

Restarting process via cron every 12 hours

I'm not familiar with cron at all, and I've looked it up and am still confused as to how specifically it works. I'm on CentOS 6.5, and I need to end a process and then start it again every 12 hours. ...
0
votes
1answer
40 views

how to set crontab PATH variable

I had a problem running a script from crontab. After some research I understood the problem was because PATH parameter doesn't include /sbin. I looked what it does include in /etc/crontab: ...
1
vote
1answer
42 views

Cannot edit crontab as non root user

When I use the command crontab -e on my Debian server as a non root user (in this case as postgres), I can't edit it because of "/tmp/crontab.SJlY0Y/crontab" [Permission Denied] crontab -l on the ...
0
votes
2answers
32 views

`cron` service and `at` command

Help to understand: is there any relation between cron and at command. Actually if I stop the cron services in SUSE by running following command: /etc/init.d/cron stop after above, if I run at ...
4
votes
2answers
37 views

Create new temporary directory

What's an effective way of creating a new /tmp directory, that behaves just like /tmp (purged on reboot, etc.), but in a different location? In my case, I want to create a ~/dev/tmp directory where I ...
0
votes
2answers
52 views

How to kill a process in shell script which is running through cron?

I have a shell script which runs in cronjob. This shell script has to kill a process which is running and start the new process again. When I run the script manually it works perfectly fine, but when ...
-2
votes
1answer
23 views

Run job at boot and on a schedule from same crontab

I have a process that I need to run on boot and periodically. I've created a file for it in /etc/cron.d/. Is there a way for me to specify that I want @reboot 0,30 * * * *?
4
votes
2answers
222 views

Schedule job at irregular intervals

It's simple enough to use cron to schedule a job to occur periodically. I'd like to have something occur less regularly -- say, run the job, then wait 2 to 12 hours before trying again. (Any ...
1
vote
0answers
27 views

How to find out why my cron didn't run? [duplicate]

This is the content of root's crontab: 0 23 * * 0-4 /usr/sbin/rtcwake -time `date --date="+16 hours" +"%s"` -m mem This is set to fire off that command every Sun-Thu at ...
1
vote
1answer
31 views

bash script not being run by cron [duplicate]

I have a very simple bash script that runs flawlessly when I do ./removeOldBackup.sh or sh /home/myusername/backup/removeOldBackup.sh but when I add it to crontab like * * * * * sh ...
4
votes
3answers
59 views

Cronjob to run script every 3 weeks on Wednesday

Is it possible to schedule a cron job that would run every three weeks on Wednesday (8AM) only? Or, if that is not possible, to run a job every 27 days or less but on Wednesday at 8AM.
1
vote
1answer
60 views

Why doesn't my supervisor daemon start on reboot?

I have added a crontab entry via crontab -e for the current user: @reboot supervisord -c /etc/supervisord.conf Yet after the reboot, supervisord demon is not running. I need to run the command ...
1
vote
2answers
51 views

How to determine the newly closed file within a continuous audit log rotation?

I am attempting to find the best way to determine when the second file (of a matching criteria) is created. The context is an audit log rotation. Given a directory where audit logs are created every ...
3
votes
2answers
53 views

How to make Cron run

I am trying to set up cron to run the mysqlauditgrep command (its the MySQL 5.6 Utilities package). The mysqlauditgrep command is in bash. The command I am looking to run is: mysqlauditgrep ...
1
vote
1answer
39 views

How to set up Cron to run mysqlauditgrep command for 11AM on Friday

I am trying to set up cron to run the mysqlauditgrep command (its the MySQL 5.6 Utilities package). The mysqlauditgrep command is in bash. The command I am looking to run is: mysqlauditgrep ...
1
vote
1answer
78 views

Logrotate does not work for httpd service [closed]

We have logrotate working for several Centos servers. One new server has a slightly different setup, and for some reason logrotate does not work for the httpd service. When I start it manually, it ...
0
votes
2answers
73 views

Unix 11i v2 Script to detect new files within directory

I was hoping someone can point me in the right direction. I would like to create a script to check for new files (files with today's date) within a directory and then print the results to a text file. ...
1
vote
0answers
62 views

Permission denied when running logrotate with anacron

I am trying to figure out what is causing anacron to send me the following error message: /etc/cron.daily/logrotate: /var/log/mariadb/mariadb.log-20140710.gz: Permission denied error: error running ...
3
votes
1answer
60 views

sudo source: command not found

I want to run this program as root. It activates a virtual environment and runs a python program in that virtual environment. The program looks like this $cat myfile.sh source ...
1
vote
1answer
42 views

Why isn't this crontab job running

I have a cron job that runs every minute on an Ubuntu 12.04 box $sudo crontab -e * * * * * mylogin /pathto/file.sh > /log/filelog If I run file.sh, the bash script does some stuff and echos out ...
4
votes
1answer
50 views

Is it possible to put arithmetic expressions in a crontab?

I know I can do simple arithmetic in shell scripts, like so: #!/bin/bash ((sum = 1 + 2)) echo sum This will output 3 on execution. My question now is, can this kind of expressions be used in ...
-2
votes
1answer
48 views

How to send a message in Minecraft before rebooting the server? [duplicate]

I have a Ubuntu Linux Server 14.04 LTS which is running a Minecraft server. I want it to reboot every 6 hours. I have that now and after the reboot, it starts the Minecraft server. Now what I want. I ...
0
votes
1answer
43 views

Autodelete old files

I've many shares on my samba server with recycle bin module activated. When deleting remote files from Windows I see .Trash directory. I'd like to automatically remove older files, i.e. 30 days or ...
1
vote
1answer
35 views

Add a custom CRON job from the command line?

Debian seems to have directories for cron jobs such as /etc/cron.daily and /etc/cron.hourly, but is there a way for me to automate editing, removing, and updating cron jobs from an automated script? ...
2
votes
3answers
51 views

Limit a text file to 100MB

I have several log files on my server that I would like to limit to 100MB large. I'm considering creating a cron job that will run once a month and remove the oldest characters (closest to the top) ...
2
votes
0answers
102 views

`crontab -e` sometimes fails with “Creation of temporary crontab file failed”

From time to time crontab -e fails on me on a Ubuntu box. It is the same for all users including the root and crontab -eu <user> under the root. Goes like this on a regular basis, a success here ...
1
vote
1answer
24 views

Insert variable and keep the variable

I'm on VMWare which, no matter what anyone says, responds to most unix commands. Some things are unique though, for example the fact that almost no files are persistent through reboot. Due to this ...
9
votes
1answer
104 views

Finding which cron jobs are scheduled to run at some future date/time X

Is there a way to "query" a crontab to find which cron jobs run at some arbitrary date/time, or during a certain range of times? For example, determine which will be run at sometime between 14:00 and ...
2
votes
1answer
30 views

don't log cron events in auth.log

In my /etc/rsyslog.conf, I have following line to log auth facility into /var/log/auth.log: auth,authpriv.* /var/log/auth.log but the file is flooded with cron logs, sucgh as these: ...
0
votes
2answers
33 views

Write log for a false statement of an if condition which returns exit 2

I have a script running every 5 mins with two exits in a condition clause. #!/bin/bash date=$(date +%Y) if [ $date -eq '2014' ] then echo "Current year is $date" exit 0 else echo "Current ...
1
vote
2answers
77 views

Script runs manually but not from cron

As per the monitoring of my mysql replication status. I wrote a simple shell script with the following code #!/bin/bash date > /tmp/mysql_repl_status.txt cd /usr/bin/ "/usr/bin/mysql" "-e" "SHOW ...
2
votes
1answer
27 views

where does Cron look for the default mail binary?

I have setup Cron Jobs to run inside a Chroot Environment, depending on the User/Group; I have noticed that these cron jobs, running inside the chroot environment, fail to send any mail. Log files ...
4
votes
2answers
103 views

Execution order with multiple commands

I'm relatively new to Linux and I'm working on a CronTab for scheduled backups. I figured out how to do multiple sequential jobs with ; and &&, but I'm unsure how the dependency affects the ...
1
vote
1answer
38 views

Crontab does not run?

crontab -e 0 */4 * * * root /usr/bin/rsnapshot hourly 30 3 * * * root /usr/bin/rsnapshot daily 0 3 * * 1 root /usr/bin/rsnapshot weekly 30 2 1 * * root /usr/bin/rsnapshot monthly tail ...
1
vote
2answers
36 views

Where is the cron information stored on my gentoo system?

I have a Linux gentoo system, which performs a cronjob every day at 3:10 in the morning. However, no file in /etc contains any related information to this particular cronjob, and the result of crontab ...
3
votes
1answer
887 views

Cron job to delete files older than 3 days

I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory /a/b/c/1 & /a/b/c/2 & /a/b/c/3) Can this be done ...
6
votes
1answer
300 views

Recover cron jobs accidently removed with crontab -r

I entered crontab -r instead of crontab -e and all my cron jobs have been removed. What is the best way (or is there one) to recover those jobs?
3
votes
2answers
62 views

Detecting cron tasks run by another user

I am currently working through the Nebula challenges on exploit-exercises.com, and one of the challenges relies on a script being run by cron. This is run by another user (flag03) and the user I am ...
2
votes
1answer
74 views

How do I set cron to run on background?

I am on ubuntu 12.04 and following this tutorial. I want to setup cron to run in the background but I don't have a chckconfig in sbin so I can't run sudo /sbin/chkconfig crond on I am fairly new to ...
27
votes
1answer
1k views

Why aren't crontabs stored in user home directories?

I'm curious to know: why are crontabs stored in /var rather than in the user's home directories? It makes it a total pain to isolate these files for upgrades but I suspect that there is a logical ...