All Questions
Tagged with shell-script cron
287 questions
0
votes
2
answers
99
views
How to temporarily sleep only certain part of a crontab job?
I have a RHEL 8.x / Oracle Linux 8.x installation with a cronjob that runs every 3 minutes as follows. At the end of the script, you will see 4 different if's that check the different files and send e-...
1
vote
1
answer
268
views
Running a cronjob that requires setting of several environment variables in particular directory
I need to setup Cron Job to run regressions for which I usually follow below steps in terminal:
cd path/to/regression_dir/
source setup.csh
perl "regression_script.pl"
The setup.csh files ...
0
votes
1
answer
36
views
Crontab run after deleting a file
I have a script thar I want to be executed each first minute of each hour. Thus, i made a second file named crontab.sh:
$ cat crontab.sh
#!/bin/bash
#cript path
script_path="/mnt/lap_c/home/...
0
votes
1
answer
655
views
crontab /bin/zsh: can't open input file: test.sh
I am trying to create a crontab to run a script:
* * * * * cd /Users/test3/Desktop/Scripts/backup/ && /bin/zsh test.sh > /tmp/cron-output.log 2>&1
where test.sh is in /Users/test3/...
0
votes
1
answer
123
views
How to detect if a process runs longer than X seconds, then do something with it?
I’m on debian.
I am calling a ffmpeg process to generate a mp3. this gets called from a php script using shell_exec. This works fine 99% of the time.
Sometimes, the ffmpeg process doesn’t exit and I’m ...
0
votes
0
answers
206
views
Write output of multiple python scripts to single file
I used to have only one Python script, the output of which would be directed to a log file.
It works like this: I have it in autostart, using crontab
@reboot /bin/sleep 30; sudo /usr/bin/python3 -u /...
0
votes
1
answer
219
views
shell .sh script does not execute all tasks within, except when run manually [duplicate]
I run a shell script at reboot, by having it in my crontab:
@daily apt-get update && apt-get upgrade -y
@reboot bash /root/Start.sh
@reboot /bin/bash -c 'sleep 10 && /bin/mount -a'
...
...
0
votes
4
answers
1k
views
Cron Job: Best Practices
I have written a bash script which will be setup as a cron job in the future.
During the script development I have added echo lines to help me follow and debug my code, like the code snippet below:
#!/...
0
votes
3
answers
340
views
save the output to multiple files in crontab
There is a script scheduled in crontab.
0 2 * * * /usr/local/bin/backup.sh >> /root/output_all.txt
I want to save the output into multiple files like output_all.txt and output_date.txt at the ...
0
votes
1
answer
337
views
What things can be done to make a Bash script containing sudo commands, running with the timer schedule ‘crontab’ work?
I try to run a script that I named script1.sh:
out="/home/me/scripts/out.txt"
sudo ntpdate 99.99.99.99 >> $out
on a timer with the crontab in a Centos 7 operation system. The aim of ...
1
vote
2
answers
3k
views
Debian : how to use a sudo bash script without password at startup
I am on Debian 11 testing. It's a low-end computer intended for users with little computer experience and I want to keep it up to date with a script that do not prompt users for a password.
Following ...
0
votes
2
answers
293
views
RHEL7 Cron entry gives ambiguous redirect error? [duplicate]
We have a crontab entry that ends up sending an ambiguous redirect error. Pretty sure it's the command to read the date, but don't know how to fix. Are there other solutions?
/bin/sh redirects to /bin/...
-1
votes
3
answers
964
views
How can I use $(pwd) in a bash script run via crontab?
I have a script named Run_at_startup.sh, which contains the following line:
/bin/bash "$(pwd)/Testing_3.sh"
If I manually run Run_at_startup.sh, Testing_3.sh will be run properly. However, ...
1
vote
2
answers
806
views
How to start a screen with crontab
sudo Crontab -e
15 0 * * 1-5 /usr/bin/screen -S wake_up -d -m /home/pi/auto/wake_up.py
But at 00:15 there is no screen started...
This command: (worked in terminal)
screen -S wake_up -d -m /home/pi/...
0
votes
3
answers
1k
views
How can I log shell errors in scripts called by a cron job?
This morning I found a message saying just so:
EDIT: I add the header of the message as well, so it is clear where it came from.
Return-Path: <root@REDACTED>
Received: from localhost (localhost [...