Add cronjob with bash script - No crontab for root
147
Sounds like (a) root's crontab is initially empty and (b) the -e
option is set in the shell.
If the user's crontab file is empty then crontab -l
exits with status 1.
If shell is running with -e
option then it will exit immediately on failure (defined as exiting with non-zero status).
Look for errexit
in the output of echo $SHELLOPTS
to check for this setting. Turn it off in the current shell with set +e
.
Related videos on Youtube
Author by
Lane Jessen
Updated on September 18, 2022Comments
-
Lane Jessen over 1 year
I have a similar issue. However, I am trying to countif in reference to another cell:
=Countif(Importrange("Sheet name", "'Sheet Tab"!DE:FH), "="&A3)
but get 0 for the result.
-
ott-- about 9 yearsCheck if you have
root
in/etc/cron.deny
. -
Jimmy about 9 years@ott-- I don't have that file at all, just
cron.d cron.daily cron.hourly cron.monthly crontab cron.weekly
-
mdpc about 9 yearsHate to ask a dumb question, but are you root when you execute these commands? Also instead of the raw commands please provide the transcript of their run.
-
Jimmy about 9 years@mdpc I am root yes. I will upload the full script when I get to my laptop but it's just that command with a
#!/bin/bash
header -
Jimmy about 9 years@JennyD my reply in the answer below solved it which doesn't appear on you link
-
HBruijn about 9 yearsTypically when scripting and packaging (and running as root) dropping a new file with a cron entry in
/etc/cron.d
is easier to maintain.
-
-
Dr.jacky about 7 yearsecho $SHELLOPTS -> braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
-
Cédric Françoys over 5 yearsJust in case : Ubuntu stores root contab under
/var/spool/cron/crontabs/root