New answers tagged

0

Although very rare, sometimes cron stops working properly even though the service is running. Here is how to verify that crond is running and stop/start the service. service crond status service crond stop service crond start


0

I was also trying something similar and came across this thread. And I solved it. The problem is that you didn't set the DISPLAY variable first to set the brightness value. Try: 26 21 * * * DISPLAY=:0 /usr/bin/xbacklight -set 80 You may check the DISPLAY variable on the terminal using: echo $DISPLAY Happy Croning! Source: http://ubuntuforums.org/...


1

In 16.04, if you have this error in syslog (CRON) error (can't fork) try: systemctl status cron.service In the result: Tasks: num_task (limit: 512) If num_task is close to the limit use: systemctl set-property cron.service TasksMax=new_max Replace new_max with a suitable value.


1

I had the same problem with mysqldump 5.7.13 in a script launched by crontab. You can set the .mylogin.cnf file location using the MYSQL_TEST_LOGIN_FILE environment variable before calling the mysqldump command : export MYSQL_TEST_LOGIN_FILE=/root/.mylogin.cnf mysqldump --login-path=mysqldump [...]


3

What you need is a lock file and check for this lock file. If it is there end the script otherwise start it. An example command would be shlock. DESCRIPTION Shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the process ID from the file and test to see if the ...


2

First, this command will find and delete all files older than 7 days in any subdirectory in /home whose name starts with securityuser: find '/home/securityuser*' -mtime +6 -type f -delete You need -mtime +6 and not +7 because -mtime counts 24h periods. As explained in the -atime section of man find (-mtime works in the same way): -atime n ...


1

as per i my knowledge: try find command like this: find ./dirc/* -mtime +6 -type f -delete ./dirc/* : is your directory (Path) -mtime +6 : modified more than 6 days ago (therefore, at least 7 days ago) -type f : only files -delete : no surprise. Remove it to test before like rm


0

This is a very old question, but none of these answers seem satisfactory. First make your cron job run every minute, then run cron as non-daemon (temporarily, just kill any crond that may have already started) with test logging: crond -nx test And see the log of your program execution flowing through your terminal.


2

A bash script must start with a shebang, to let the launching process know it's a script that should be run in the bash shell. So the first line of your script should be #!/bin/bash. This is a good convention to get into, it is how bash scripts should be written. Your script currently works when you run bash /home/backupscript.sh because you're already ...


3

Make sure your script has set the execute flag when executing it directly or use bash as interpreter with the script as input. To use bash as interpreter change the line to 0 4 24-31 * 4 bash /home/backupscript.sh To set the execute flag for the script use: chmod +x /home/backupscript.sh


0

We've also seen this on OpenVZ VMs running Debian. The OpenVZ provided templates/images have all cronjobs from /etc/cron.* disabled by default. I have no clue why they did that, but it seems that this issue is caused by the template/image used and has nothing to do with any particular VPS provider.


1

I created my-script on Windows, so the shebang was correct, but had a Windows line ending. This will cause a cron script to fail. Recreating the script on Ubuntu (and chmodding it etc) fixed the problem.


-1

I have just landed here because I have the same problem. And it's a misunderstanding: You DON'T have to execute * * * * * cd /var/www/html/SuiteCRM-7.6.4; php -f cron.php > /dev/null 2>&1 You HAVE to add this line to the crontab file Execute: sudo crontab -e Choose your favorite editor, and add the line at the end (the 5 stars * are ...


2

The other answer is great! But it requires root cron. If you want to hibernate from non-sudo cron, there are 2 options: 1. Using polkit Make a file containing the following: [Enable hibernate to be run via cron] Identity=unix-user:* Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions ResultAny=yes named ...


1

Looked like you previously had some quotation issues. Using ascii quotes won't work well with code, use the standard coding quote (") instead. Ascii quotes come from word processors like libreoffice or abiword; don't use those programs for coding. Use something like gedit or leafpad. Also, are you putting this in /etc/crontab? If so, you need to add a user ...


1

This is happening because it needs root privileges. The solution is to add the hibernate command using sudo crontab -e instead of crontab -e. polkit is necessary for power management as an unprivileged user. If you are in a local systemd-logind user session and no other session is active, the following commands will work without root privileges. If ...


0

You can simply mount your ssd as /tmp partition. To mount on loading you can write this to /etc/fstab/. For example: $ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added ...


0

You cannot open a program on your display from cron. Any job you wish to run via cron must not require any services of a logged in user session, including a valid display to place GUI apps on.


-1

The crontab may use a different user than you. When you say cd ~/path/to/file you are directing the file from your own user directory by using ~. You should use the absolute path which is in your case: cd /home/yourusername/path/to/file


1

I did some investigation on this, if your did "sudo crontab -e" with rtcwake inside the table without sudo, you will get the error message: /home/leo/autojob: line 4: rtcwake: command not found it seems that although "sudo crontab -e" is executed under root account, it cannot find the right command path. There are some other post says you shall put PATH ...


1

to execute a bash script via cron i would use 30 14 * * * /bin/bash /home/flicker/open-web.sh >/dev/null 2>&1 To call a web page/URL via cron & curl 30 14 * * * /usr/bin/curl http://funkyname.com/blub.html >/dev/null 2>&1 Update: After realizing you want to open an actual browser and NOT just calling a script - i guess i ...


3

Thats a perfect output, to explain it a bit I'll take it step by step: SpiRegistry daemon is running with well-known name - org.ally.atspi.Registry This one seems to be a system daemon, not really sure what he does. Starting User manager for UID 1000 This is the UID of your users group. UID 108 This is the syslogs group UID. CRON [3076]: pam_unix (cron:...


1

I'm not sure if this is what you want. I found this answer some time ago on some stackexchange and I use it on one server. for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done This will list all crontabs for all users.



Top 50 recent answers are included