Hot answers tagged

4

Your issue with the first command is that the * characters are unquoted. The shell will therefore expand them to any matching filenames in the current directory. Your issue with the second command is that the command contains both single and double quotes, so you can't reliably just quote the crontab entry with double quotes as you try to do. You would ...


3

in vi, :g/CPU_check/s/^/#/ where : tell vi to go to command mode g apply 'globaly' (for multiple line) without g would apply only to first line. /CPU_check/ address line matching CPU_CHECK s substitue /^/ beginning of line (with) /#/ # sign perfom other substitution save and quit :x


3

Same problem here. This mutt command seems to depend on a working terminal window that cron cannot build. At least for me it helped to start a virtual terminal using screen: screen -d -m mutt -f /var/mail/root -e "set alias_file=/var/mail/root" -e "set crypt_use_gpgme=no" -e "push <delete-pattern>~iSomeMessageId@messageid.test\n<sync-mailbox>qy"...


2

I added this to my crontab and all my notifications work (currently tested with zenity and notify-send): DISPLAY=":0.0" XAUTHORITY="/home/me/.Xauthority" XDG_RUNTIME_DIR="/run/user/1000" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus


2

Correctly quoted line should look like this: $ echo \*/2\ \*\ \*\ \*\ \*\ /usr/bin/aws\ ssm-send-command\ --document-name\ \"AWS-RunShellScript\"\ --parameters\ \'\{\"commands\":\[\"echo\ \{\{ssm:/mr2/cloudwatch-custom\}\}\"\]\"\}\'\ --instance-ids\ \"\$INSTANCE_ID\"\ --region\ us-east-1 Of course, I didn't come up with this crazy quoting by myself, I used ...


2

cronie is the package that contains the actual cron daemon. It is a fork of vixie-cron. cronie-anacron provides the anacron tool that allows specifying things to run daily/weekly/monthly/etc. without necessarily specifying the exact time, so that systems that are shut down irregularly can have periodic maintenance jobs. If you don't want to use anacron, the ...


1

I have found a solution. Apparently the problem was in the polkit package that defines the policies for users to shutdown, reboot, suspend, hibernate, etc As I had no rule file in /etc/polkit-1/rules.d the default is not to allow users to hibernate or suspend the machine while a user is logged in (I believe the problem here is that I'm locking the machine ...


1

The answer depends on the exact variant of cron you’re interested in. In Debian, the cron daemon is documented as reloading /etc/crontab whenever necessary: Like /etc/crontab, the files in the /etc/cron.d directory are monitored for changes. and indeed, the main loop reloads all the cron databases at every iteration (the loads only happen if files have ...


1

try breaking into two string echo "*/2 * * * *" /usr/bin/aws ssm-send-command (...) >> /etc/cron.d/lvm_disk_space this way * won't be expanded to local filenames, and you get remaining argument. Note that external quote are removed. e.g. --document-name "AWS-RunShellScript" is expanded as --document-name AWS-RunShellScript


1

Creating a Docker container in order to execute jobs to other containers is a good practice, If You have a separate container for databases and one for your Django application, it would be a good practice to have a separate docker container running for cron jobs, as with the time your project might grow and you would have a centralized crontab by that time ...


1

Does this one answer your question sufficiently?: Where is cron's PATH set? (as per comment) Check also the comment on the accepted answer. Have you tried scheduling a script that prints it's environment variables using a command like env? That should get you the answer on your own system, as things can change over time and, of course, we can ...


1

Finally, I've found it was a selinux issue, but it was somewhat hidden, so I run: semodule --disable_dontaudit --build then I've found those denials, I've created selinux modules for exception and applied and now it works fine. Then, I've run: semodule --build


1

Append one blank line to the end of your downloads file. Cron jobs need new line termination characters. Also, it is better to manage cron jobs with crontab -e (if you want root priviledges, sudo crontab -e). In case you forget the new line, crontab will warn you.


1

From comments it is clear that you want to run the cron job as root. You can schedule such a script in two ways: Put it in the system's crontab in /etc/crontab. This crontab is a crontab file with an extra user field, like what you show in your question. I would not recommend this though as some Unix systems may manage this crontab by automatic means. ...


1

I've typically seen this if the user account has expired, which can happen for the root user as well. To check, su to the user and check if you get Authentication Failure, e.g.: $ sudo su - Your account has expired; please contact your system administrator su: Authentication failure (Ignored) To fix: update the expiration on the account: sudo chage -M ...


Only top voted, non community-wiki answers of a minimum length are eligible