Tag Info

New answers tagged

1

=== Docker alert === If you're using docker, I think it is proper to add that I couldn't manage to make cron to run in the background. To run a cron job inside the container, I used supervisor and ran cron -f, together with the other process. Edit: Another issue - I also didn't manage to get it work when running the container with HOST networking. See ...


0

As default, cron's logs saved in /var/log/syslog. It depends on rsyslogd configuration. You can change it: Go to rsyslog config cd /etc/rsyslog.d/ sudo nano 50-default.conf Uncoment line: #cron.* /var/log/cron.log Save file and restart rsyslog sudo service rsyslog restart Restart your cron daemon for get it's messages from new ...


1

When cron doesn't work, it'll send out a mail to the user root. The only problem is: you don't have the software to send / store the mail in mailboxes. But have no fear, Postfix is here! Install Postfix sudo apt-get update sudo apt-get install postfix heirloom-mailx When install postfix, it'll ask you how to you want to setup it up. On the first ...


0

A simple solution from bash-hackers.org that worked for me was using mkdir. This is an easy way how to make sure that only one instance of your program is running. Create a directory with mkdir .lock which returns true if the creation was successful and false if the lock file exists, indicating that there is currently one instance running. So this ...


0

I have given up on this. Tried everything imaginable. Kalarm which is also native to KDE runs great. It is easy to use and schedule and will run anything I can do in the Konsole.


1

Let's start. Create load.sh script nano /path/load.sh #!/bin/bash #we use output from "uptime" i "w" to have load on 5 min UPTIME=`uptime`; W=`w`; RAM=`free -m`; DATE=`date`; sleep 3 DF=`df -h` sleep 3 echo "######################################" >> /var/log/load-result/load_log echo "$DATE" >> /var/log/load-result/load_log echo "" ...


0

Files in cron.{daily,hourly,weekly...} are not in the crontab format, but scripts or executables that are directly executed. Files in cron.d are in the crontab format. Either: Move mc2xmlUpdate to /etc/cron.d, or Copy/link /home/username/mc2xml/update.sh to cron.daily Also, your PATH specification contains a ; instead of a :.


1

KCron & Cron KDE UserBase KCron: https://userbase.kde.org/KCron KCron is a tool for running applications in the background at regular intervals. It's a graphical interface to the Cron command. Ubuntu Community Cron HowTo: https://help.ubuntu.com/community/CronHowto GUI Applications It is possible to run gui applications via cronjobs. ...


0

Why its not working ? To do apt-get update and apt-get upgrade you must become a sudo user. I mean your script should executed with sudo privileges. Any other stoppings ? Yes , you are not doing giving -y that let upgrade command automatically download after update. Is it a major thing ? Yes , if you dont pass -y along with command then your cron will ...


1

I suppose that you are using crontab with normal user which means that he can't update/upgrade a system without providing a sudo. Also apt-get update and apt-get upgrade will prompt user for confirmation so you have to pass this confirmation before. yes | apt-get update yes | apt-get upgrade So to solve it you have to run your commands with sudo, but ...


1

Anacron can you what you are asking and is available in the Ubuntu repo's. From the man page: Anacron is used to execute commands periodically, with a frequency specified in days. Unlike cron(8), it does not assume that the machine is running continuously. Hence, it can be used on machines that aren't running 24 hours a day, to control regular jobs as ...


1

check following all are correct. (1)-f file.php Parse and execute file */10 * * * * /usr/bin/php -f /var/www/html/register.php (2) give file following permission chmod -x /var/www/register.php (3)check which php $ which php /usr/bin/php if its diffrente then its affect your cron tab. (4)if you are using any url related operation in ...


0

To run the script like it's running on your own account (with bash) change your crontab to the following: */15 * * * * sudo -u ashish /home/ashish/parser.sh This will run the script almost as if you executed it from the command line on your own account.


3

*/15 * * * * . /home/ashish/parser.sh cron uses sh, not bash, so when you source the script (that's what the . does), it is run under sh, not bash. Remove the .. Also, the PATH for cron is limited. Specify the full paths to commands you use, such as workon, or set PATH yourself.


0

Try this go to. sudo crontab -e then put this line above your cronjob. MAILTO="" save and Exit.


0

Really I don't know why ifdown doesn't work with crontab. Anyway, I faced the same situation a long time ago and have a workaround solution, hope this will help you. Replace ifdown eth1 with /sbin/ifconfig eth1 down 1> /dev/null This worked for me.


1

My recommendation would be to put call the script using standard web path, so you don't mingle the users and permissions, e.g. instead of doing: /usr/bin/php <script> rather do: /usr/bin/wget -q http://localhost/test/cron.php Then you need to make sure the script can be called just from localhost (f.e. using Apache2 access policy). This way the ...


0

Check the output of which php and use the absolute path for php (in my case /usr/bin/php5). */2 * * * * /usr/bin/php /var/www/test/cron.php or just */2 * * * * php /var/www/test/cron.php For clarification, the default $PATH for cron is PATH=/usr/bin:/bin You can check the $PATH with a test entry (Source): * * * * * env > /tmp/env.output ...


0

Try this procedure: create /home/user/logrotate folder mkdir /home/user/logrotate create /home/user/logrotate/my.conf configuration file with logrotate directive as you need create /home/user/logrotate/cronjob to run logrotate every day at 2:30 AM (this is an example) 30 2 * * * /usr/sbin/logrotate -s /home/user/logrotate/status ...



Top 50 recent answers are included