S
S
Sergey2017-10-05 09:23:05
linux
Sergey, 2017-10-05 09:23:05

What's wrong with the crontab entry?

What's wrong with the crontab entry??
I write like this:

@midnight  bash /bin/bash ~/backup.sh > /tmp/tmp.cron

Nothing is written to /tmp/tmp.cron after startup.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikhail Grigoriev, 2017-10-05
@svakhovksyy

1. Check the execute (x) bit on the ~/backup.sh script with the command
if there is no execute (x) bit, then set:
2. Check the cron logs 3. Always! I repeat, Always specify the full path to the script being run, i.e.
4. I recommend organizing the output of debugging information and error handling to the log at the script level, and writing the construction in crontab:
to redirect all output and error streams to /dev/null
if you write a construct like this,
then only the output stream will be redirected to /dev/null, if a script execution error occurs, then cron will notify the root user by email (provided that mailing is configured correctly on the server )

S
Sergey Pozdnyakov, 2017-10-05
@Afinogen

Why do you have bash /bin/bash ?
Enough bash ~/backup.sh > /tmp/tmp.cron

K
kisaa, 2017-10-05
@kisaa

I would specify the exact path instead of ~.

K
ky0, 2017-10-05
@ky0

Does the bash user exist on the server?
upd. try like this:
in the first line of the script, the interpreter must be specified - #!/bin/bash

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question