Crontab - simple echo not running
May be it is, cron jobs will run in their own shell. So you can't expect to see asdf
on your console.
What you should try is
* * * * * echo asdf > somefile_in_your_home_directory_with_complete_path.log
Next check the file by doing a tail:
tail -f somefile_in_your_home_directory_with_complete_path.log
And if it's not, check if the cron daemon itself is running or is down:
# pgrep crond
OR
# service crond status
Ubuntu crontab simple echo to file not working
you should paste the full path of script. For example 25 11 * * * /home/xxxx/test_script.sh
crontab not fully working. only echo statements being run
Including the path to bash shell might be needed:
* * * * * /bin/sh /home/sys_bio/username/tracer.sh >> ...
cron
otherwise might not really know what to do.
The same principle also applies to what is included in your script. Using relative file names can fail since they are often not interpreted the same as if you were using your local interactive shell (eg):
test.json
It might be necessary to use the absolute paths (eg):
/full/path/to/test.json
EDIT: It's apparent from the error generated by Python the issue is definitely path related. Python is trying to locate the module in the path /home/sys_bio/username/p35/bin/python3.5
instead of two directories up in /home/sys_bio/username/
. The fix would be to cd
into the directory or by giving the absolute path to the module. By adding the following into the .sh
script:
cd /home/sys_bio/username
Should allow the command following it to look for the module there instead of two levels down.
Cron Job Doesn't Run
The cronjob is running just fine, but the cron daemon (daemons in general as far as I know) have no access to stdout so cannot output messages to the terminal.
To test it you can, however, output what you want to a file using
*/1 * * * * echo "job every minute" >>$HOME/filename
which will output (and concatenate) the text to a file named "filename" in your home directory every minute.
Related Topics
Graphing The Dag Generated by Make
"Must Be Connected to a Terminal Error" with Screen -X Command on a Linux Container
Uses for This Bash Filename Extraction Technique
Git: Can't Push (Strange Config Issue)
Shared Volume in Docker Through Vagrant
Starting Ddd with Remote Gdbserver
Apache Cgi in User Directory "End of Script Output Before Headers"
Executing Exe or Bat File on Remote Windows Machine from *Nix
How to Find The Memory Consumption of a Particular Process in Linux for Every 5 Seconds
How to Take Advantage of The Vdso Object with Your Own Programming Language
How to Execute a Command Inside a Screen Session
What's The Difference Between Insmod and Modprobe
How to Run a Windows Docker Container on Linux Host
Ansible: Check If Service Is Listening on a Specific Port
Fork() and Stdout/Stderr to The Console from Child Processes
Replace System Call in Linux Kernel 3