Questions tagged [crontab]
Crontab is a short form of cron table. It is a configuration file that specifies shell commands to run periodically on a given schedule.
320
questions
0
votes
1
answer
132
views
Cron job does not execute according to time schedule
Consider the following cron job:
* 22-23 * * * /usr/bin/curl -u username:paswword http://api.example.com/api/test2.php
Now, according to this, the cron job must run every minute starting from 22h00 (...
1
vote
1
answer
135
views
What happens if I execute swapoff && swapon when RAM + swap exceeds RAM capacity
What happens if I execute the command
sudo swapoff -a && swapon -a
having RAM full 25GB/32GB and swap full 20GB/32GB? 25+20 = 45 > 32 so there's no way RAM can fit all operating data. On ...
3
votes
1
answer
506
views
Is that anyway to use with crontab with two commands such as shutdown and run script after reboot?
Is that anyway to use with crontab with two commands such as shutdown and run script after reboot?
My entire command is not work. Only first command works:
22 16 * * * sudo shutdown -r
25 16 * * * @...
2
votes
1
answer
182
views
Within Docker, how to correctly add a task to cron programmatically (scripting)? no errors are perceived in log
After several days of messing around with Docker, I have not found a solution to my problem.
In short, I have tried to add cron to php:8.1-apache-bullseye and pass it a file with the task that I want ...
0
votes
1
answer
97
views
OSX cronjob doesn't have permission to touch existing files in Downloads?
I recently updated from OSX 13.2 to 13.5.2 and all my cronjobs are failing now.
I'm trying to run rsync in a cronjob but it keeps failing, and I ultimately narrowed that down to my cron jobs not ...
2
votes
1
answer
158
views
how do I remove errant control characters from crontab
I edited my crontab and strangely started getting "error: bad minute". Searching around, I discovered the cause was errant control characters. I can see the character $ at the end of each ...
0
votes
0
answers
63
views
Running a "System Events" automation using crontab in MacOS
update -
the crontab is running the binary, but nothing happens, no errors or any output. it's have the same behavior as if it has no permissions the change the system settings
I want to execute dark-...
4
votes
1
answer
312
views
Where is crontab's time command documented?
I'm searching for the documentation of the time command that can be prepended to the script in crontab
* * * * * time somescript.sh
16
votes
2
answers
6k
views
Can I specify a specific time with seconds with Linux crontab?
49 18 * * * mpv ~/Musik/Donau.mp3
This command would play the Donau.mp3 file at exactly 6:49pm. How could I, for example, specify 6:49:50pm?
1
vote
0
answers
168
views
mount and systemctl not executing inside crontab
Under root, i run crontab -e and write :
0 21 * * * systemctl stop transmission-daemon && umount /mnt/WD5 && hdparm -y /dev/sda
I also tried
0 21 * * * mount /mnt/WD5
None of them ...
0
votes
2
answers
983
views
Why is crontab not executing my .sh file?
I am completely and utterly confused at why crontab with not run this .sh file. I'm using a package called pushover notifications to send a notification to my phone. I've tried so many different ...
1
vote
1
answer
122
views
How to pass keyword to background process to close properly?
I have just created a shell script and and added to crontab -e
Crontab is working fine but when I kill process manually the recorded video of that process is not playable.
Because when I run the ...
0
votes
1
answer
625
views
Crontab append a command to certain user using shell
I am trying to set up a cron job using a shell script but I am unable to find a solution to it I am trying to use crontab like this:
#cron.sh
echo "*/1**** /opt/file/test.sh" | crontab -
I ...
0
votes
0
answers
49
views
I created a cronjob years ago, now it is still running on the server but I can't locate it with "crontab -e", what can I do?
two years ago I created a cronjob which execute a python script to backup stuff. Now, the thing is that this cronjob is still running:
/var/log/cron.log.1:Oct 9 20:00:02 syslogngsrv CRON[28292]: (...
0
votes
0
answers
39
views
How execute EdgeOS crontab jobs
I have this in sudo crontab -l
0 17 * * 1-5 ipsec start
0 06 * * 1-5 ipsec stop
The commands sudo ipsec start and sudo ipsec stop work splendidly. But the scheduled jobs are not executing. What else ...
0
votes
0
answers
429
views
Automating Borg Backup with cron fails
Background
I would like to use Borg Backup as a backup solution (backup on remote server). Borg offer sa very convenient sh script that they say you can just run as a cron job. While the script works ...
2
votes
2
answers
9k
views
How to properly use environment variables in crontab
I export a variable in my ~/.bashrc file (Ubuntu 20), which I'd like to use in a cron job.
Searching for answers, I found two ways of doing it, but none worked for me:
12 11 * * * BASH_ENV=/home/l86/....
2
votes
2
answers
2k
views
Ansible playbook runs from user, but not from crontab
I have a weird behavior on a crontab job I'm trying to run using Ansible's playbook.
First of all, I have similar crontab's lines using Ansible playbooks that works perfectly, so the issue is either ...
2
votes
1
answer
2k
views
Why is Cron not using local time?
0 11 * * * $HOME/.aws/killem > cron.log
It looks valid to me but it is not running
I've also tried
40 11 * * * /home/ec2-user/.aws/killem > cron.log
but that doesn't work either
This works:
*/...
0
votes
1
answer
754
views
Reload nginx configuration when rsync updates nginx.conf
I have two web servers, server1 and server2.
On server2 there is an rsync command, scheduled in crontab, that updates /etc/nginx folder when I make some changes on server1:
*/5 * * * * rsync -avzhe ...
0
votes
0
answers
1k
views
crontab -e: crontabs: No such file or directory
I am trying to set up a cron job in my user crontab on a debian 11 image on a VPS.
But I have issues and cannot open crontab:
flo@debian-2gb:~$ crontab -e
crontabs: No such file or directory
flo@...
2
votes
1
answer
265
views
Additional crontab stored in a git repository
I have an app that has some functionalities that are scheduled via crontab.
Is there any way for me to keep these crontab-launched commands in a git repository, and at the same time add them to the ...
0
votes
1
answer
111
views
Check if file crontab runs
I've set up crontab tasks to be executed every min.
* * * * * sudo /usr/bin/php /root/scrapers/terra_plf/terra_swap_api.php
I see its log in var/log/syslog file:
Jan 3 15:14:01 clearthefog CRON[...
1
vote
0
answers
442
views
Unable to run Bash Script in Cronjob on Mac
Below script can execute from normal user but I can't able to run script through cronjob on macos(bigsur): Following error comes when script is executing through job security: ...
0
votes
1
answer
125
views
Crontab task does not work, Linux, Debian
At a Debian server I've set a crontab task using crontab -e with the following content:
*/2 * * * * /usr/bin/php /root/scrapers/terra_plf/terra_swap_api.php
Why doesn't it work?
When I run the same ...
0
votes
1
answer
2k
views
Cron files copied directly into /var/spool/cron/crontabs do not execute
Copying a crontab file directly into /var/spool/cron/crontabs/<username> does not schedule the job for execution.
crontab -l shows the file contents, so cron is at least somewhat aware of it. ...
0
votes
1
answer
389
views
Script works fine while execute, but won't run from cronjob
I have a script called "record.sh"
It looks like:
#!/bin/bash
/usr/bin/vlc -vvv rtsp://admin:[email protected]:554/ch0_0.h264 --sout=file/ts:Videos/VideoCaptures/recording-$(date +"...
0
votes
1
answer
311
views
The rust file is not working as I `cargo run` with crontab
I type sudo -i to proceed to edit commands of crontab.
I've written the following line inside the file of crontab.
@reboot cd /home/username/superuser && cargo run;
The following content is ...
1
vote
1
answer
913
views
Script in crontab only partially executed
My scenario:
I've some python scripts on a raspberry pi. They behave like a service, they run forever without exiting and process signals. They are meant to run in the background, writing some values ...
0
votes
2
answers
882
views
Speedtest-CLI Cron Job Not Working
Cron job is setup as:
*/15 * * * * speedtest >> /home/pi/speedtest.log
The speedtest script is:
#!/bin/sh
speedtest-cli --csv >> /home/pi/speedtest.log
That uses Speedtest-CLI. The job ...
1
vote
1
answer
1k
views
Why did my default crontab editor change?
I have an Amazon Linux instance I have been using for years as a web server. It's been awhile since I've logged in. Today I logged in and noticed the default crontab editor has been changed from ...
1
vote
1
answer
1k
views
"/usr/sbin/shutdown now" not working in crontab in WSL in win10
Recently I started using win10 and WSL.
I want to let crontab run the following command.
/usr/sbin/shutdown now
But it's not working even the command works in Linux OS (I checked it already).
The ...
0
votes
1
answer
847
views
Why isn't Crontab executing my script on reboot?
I have a script that launches my website located in /home/webserver/run-website
#!/bin/bash
echo "launching website..."
service nginx start
cd /home/webserver/django_personal_website
...
1
vote
1
answer
481
views
Trying to run a python script on startup on my raspberry pi
I've googled how to do this but I don't understand enough about linux to be able to interpret the answers.
I ssh into my pi and log in using the user 'pi' and the password I set.
Then I type sudo -s ...
1
vote
1
answer
744
views
Failure to change my desktop background via crontab
I have a shell script called test.sh:
#!/bin/sh
touch /home/me/testing.txt
/usr/bin/gsettings set org.gnome....
1
vote
1
answer
2k
views
Crontab not logging to file
I have the following cronjob:
@reboot /usr/local/bin/python3.9 /home/pi/push_bullet/push_bullet_socket.py >> /var/log/push_bullet_socket.py.log 2>&1
It's the only thing on my crontab. ...
0
votes
1
answer
593
views
Python script using Crontab
I've written a python script that will check my roster for work (which is in google sheets), take some relevant details, place them in an email and send them to me.
When I run this script manually ...
0
votes
2
answers
969
views
Run terminal command on boot using crontab
I have a server and on every boot, I have to enter npm run dev on the terminal so
Node.js server starts. How do I use crontab to do it for me on every boot?
I want something like this;
@reboot echo &...
3
votes
1
answer
409
views
certbot-auto fails to install automatic renewal?
I am using kernel 3.10 on CentOS 7. I have successfully installed CertBot 1.10.1 using alternative installation instructions as certbot-auto. Running certbot-auto successfully generated certificates ...
0
votes
1
answer
315
views
S3 command not working in cron
I have this ultra simple cron job:
48 20 * * * cd /home/pankaj;s3cmd -f get s3://myfile.gz
The command works by itself. But the cron job does not. The cron job
is created for the same user(pankaj) ...
1
vote
0
answers
2k
views
Why can't I execute shell script via crontab?
I have this script shell1.sh ubicate in /home/documents/files, the script is for the creation of users on Linux, so it asks for some information and later creates the user.
I want it to run for every ...
0
votes
1
answer
410
views
System crontab won't run for certain user on Centos 7
I have a super simple system crontab to run as a specific user. For a user that can login to a Gnome session it works fine. For another user that I use just for system tasks, it will not run.
This is ...
0
votes
0
answers
118
views
Unable to run a script through crontab in linux
When I try to run a script through crontab, it doesn't work. I don't see my script running when I run `ps aux.
But it works perfectly when I run it manually. Any reason why it's not working?
My script ...
0
votes
2
answers
604
views
Crontab entry is not working
I want a set of files copied daily from a remote server to local machine at 5 am in the morning. The following crontab entry does not work:
0 5 * * * scp [email protected]:/tmp/bkp*tar.gz /home/...
1
vote
1
answer
746
views
How would I make a cron job stop and start again?
I am trying to make a cron job that stops at 12am today(friday) then start again Monday at 7am, what would the script for this look like, I am new to cron jobs.
2
votes
1
answer
6k
views
How to log the output from an rsync backup which runs from a script using crontab?
I would like to log all the output that is generated by rsync; the output that I see when I run the script myself in terminal. I would prefer this logging to occur from within my script.
Here is my ...
2
votes
1
answer
3k
views
How to test cron @reboot entry?
How can I test if @reboot is working without the need of reboot the machine?
Is there anyway to force @reboot to entry to run?
Thank you.
0
votes
1
answer
427
views
pacmd command run in local crontab does not work
I am trying to run certain commands at startup to allow my Audio to be FIFO Piped into a file.
If i run the commands (either manually or in a script) it works fine. However when i put them in my local ...
0
votes
1
answer
1k
views
Updating Debian Linux via crontab
I am trying to have my Raspberry Pi do its own update weekly with the following command
Not certain which one to use because running the command with su root fails on my terminal.
59 2 * * 1 root ...
0
votes
1
answer
266
views
mysqlimport gives error when run as cron job but not interactively (Ubuntu 14.02)
I have a bash script which downloads and then imports a CSV file into a local MySQL. The database is MySQL 5.6 on Ubuntu 14.04, I'm loading data with the following statement (bash):
mysqlimport --...