Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have this python3 script found at /root/Desktop.security/test.py.
Would like it to run everyday at 10:03, 15:03 and 22:03. Tried all these settings in crontab, but still doesn't run my file. I tried even at reboot
# * * * * * /usr/bin/python3 /root/Desktop.security/test.py
#reboot /usr/bin/python3 /root/Desktop.security/test.py &
03 10,15,22 * * * /usr/bin/python3 /root/Desktop.security/test.py
03 10,15,22 * * * python3 /root/Desktop.security/test.py
What I am doing wrong?
Thank you!
had a typo in the command, the path had a dot in it and also the script has to be run with python3 location of script.py.
The information that you have to give the full path of python executable is obsolete. ==> therefore the correct answer is 03 10,15,22 * * * python3 /root/Desktop/security/test.py
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
#!/usr/bin/env bash
#!/bin/bash
#!/bin/sh
filename='/home/supersaiyan/sample1.sh'
for i in 1 2 3 4 5
do
echo "String $i"
x1+="String"$i
done
echo "#Added string is: $x1" >> $filename
echo "The following string has been added to the file: $x1"
Here's the bash script I created which runs fine when using the bash command. It doesn't work in crontab though.
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
5 * * * * echo '#tanginamo cron tester' >> /home/supersaiyan/samplerz.sh
* * * * * /bin/bash /home/supersaiyan/sample1.sh
Here's what I put in crontab. The first line is just for testing and is working fine so I'm really lost on why the second one isn't working.
EDIT: Tried removing the SHELL and PATH lines to no avail
The .sh file is already modified as executable
Your output should be going to a different file than your actual script file.
You need to change :
filename='/home/supersaiyan/sample1.sh'
to:
filename='/home/supersaiyan/sample1.out'
...and run the script again.
You may want to review it's contents past line 10 or so.
Enjoy! :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
When I execute my cron manually everything seems to work. However when it runs by cron it seems to run twice. In my deployment script I have the following two lines to add my crons:
/usr/bin/crontab -l | { /bin/cat; /bin/echo "* 3 * * * /etc/app/execute.py"; } | /usr/bin/crontab -
/usr/bin/crontab -l | { /bin/cat; /bin/echo "* 0,2,4,6,8,10,12,14,16,18,20,22 * * * /etc/app/solr.py"; } | /usr/bin/crontab -
Is there any reasonable reason why my CRON might be running twice on my debian server? I have no idea what might be causing this or how to debug it.
In my Crontab I have this:
* 3 * * * /etc/app/execute.py
* 0,2,4,6,8,10,12,14,16,18,20,22 * * * /etc/app/solr.py
You can debug this by adding something like
; echo $(date) ; echo "Cron line one" >> /root/cronlog
That way you can see which line was executed when.
Also, how do you edit your cronjobs? With "crontab -e" or by directly editing the files? If you edit the files directly (which I don't recommend), then please compare the content of the files with the output of "crontab -l".
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Ok, so I'm trying to set cron to run a bash script at a certain time. My bash script is essentially this
#!/bin/bash
espeak -g 3 "this is my text"
So from there, I went to the crontabs, and added in
*/1 * * * * /path/to/my/script.sh
to see if it would run, but it didn't do anything. I changed the script to
#!/bin/bash
echo "this is my script"
to see if that would do anything, but no avail. Any help? Thanks.
Try to run the script manually and see if it echos out: bash /path/to/my/script.sh
Does the file have the correct permissions?
Try Outputting errors to a log file: */1 * * * * /path/to/my/script.sh > /path/to/my/error.log 2>&1
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I see a bunch of tutorials for cron commands like
0 */5 * * * /some_sript.sh
But what file do I put this line of text in?
From tag:crontab info
Basic commands
crontab -e Edit crontab.
crontab -l Show crontab current information.
Also, you'd better write
0 */5 * * * /bin/sh /some_sript.sh
instead of
0 */5 * * * /some_sript.sh
That is, indicate the binary executing the script.
You just need to run "crontab" command to edit the cron table. Try to "man crontab".
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
below command for cron job is not working
20 18 * * * wget -O /dev/null 2>&1 http://www.rolsonscommercial.com/cronjobs/sms/autosms.php.
Please help.
Try giving an absolute path to wget (/usr/local/bin/wget on my system). You can use
$type wget
$which wget
$whereis wget
to figure this out
Also answer, what operating system? what version of cron? Is this a user crontab or system crontab - they have different formats.
Also, when do you want the cron job to run? "not working" is useless information. Answer "what do you expect?", "what is happening", "what are you doing?"