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.

Filter by
Sorted by
Tagged with
16 votes
2 answers
2k 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?
Peter Andres's user avatar
0 votes
0 answers
24 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 ...
Adrien's user avatar
  • 101
0 votes
2 answers
85 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 ...
PapRedpaw's user avatar
1 vote
1 answer
59 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 ...
Farid's user avatar
  • 21
0 votes
1 answer
162 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 ...
Nilay Singh's user avatar
0 votes
0 answers
29 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]: (...
Elia Pirola's user avatar
0 votes
0 answers
26 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 ...
theking2's user avatar
  • 334
0 votes
0 answers
176 views

scheduling python script with crontab (mac) - unable to import required dependencies

I am trying to use crontab to schedule a python script to run every day, but I'm getting this error: Traceback (most recent call last): File "/Users/name/Desktop/Scrape/scraper.py", line 5,...
Okay's user avatar
  • 1
0 votes
0 answers
189 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 ...
cosmic-hobo's user avatar
0 votes
0 answers
463 views

User cron job is somehow removed automatically

I'm trying to install a cronjob for the user www-data on my Ubuntu 20.04.4 LTS which always gets deleted after some arbitrary time without any interaction of mine. At least I can't see any regularity ...
suamikim's user avatar
  • 297
1 vote
1 answer
4k 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/....
Leandro 86's user avatar
1 vote
2 answers
1k 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 ...
leosilvapaiola's user avatar
1 vote
1 answer
825 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: */...
Vietyank's user avatar
  • 129
0 votes
1 answer
437 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 ...
Atman's user avatar
  • 25
0 votes
0 answers
441 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@...
Phil's user avatar
  • 143
2 votes
1 answer
140 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 ...
I hate Javascript's user avatar
0 votes
1 answer
44 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[...
Igor Savinkin's user avatar
1 vote
0 answers
361 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: ...
blaCkninJa's user avatar
0 votes
1 answer
73 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 ...
Igor Savinkin's user avatar
0 votes
1 answer
792 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. ...
John Gordon's user avatar
0 votes
1 answer
322 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:blablabla@192.168.2.20:554/ch0_0.h264 --sout=file/ts:Videos/VideoCaptures/recording-$(date +"...
Neo's user avatar
  • 1
0 votes
1 answer
233 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 ...
electrical apprentice's user avatar
1 vote
1 answer
679 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 ...
xph's user avatar
  • 305
0 votes
2 answers
575 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 ...
mlw4428's user avatar
  • 177
1 vote
1 answer
926 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 ...
ice13berg's user avatar
  • 238
1 vote
1 answer
793 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 ...
electrical apprentice's user avatar
0 votes
1 answer
642 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 ...
Kolby Wilson's user avatar
1 vote
1 answer
331 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 ...
NibblyPig's user avatar
  • 2,662
1 vote
1 answer
550 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....
user1551817's user avatar
1 vote
1 answer
1k 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. ...
Jacob's user avatar
  • 13
0 votes
1 answer
516 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 ...
Colin's user avatar
  • 1
0 votes
2 answers
629 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 &...
Yusuf Çağlar's user avatar
3 votes
1 answer
322 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 ...
Alex's user avatar
  • 182
0 votes
1 answer
218 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) ...
kargirwar's user avatar
  • 183
1 vote
0 answers
1k 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 ...
DDR's user avatar
  • 111
0 votes
1 answer
252 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 ...
Phil's user avatar
  • 101
0 votes
0 answers
74 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 ...
Chinmaya Rath's user avatar
0 votes
2 answers
391 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 user1@192.168.5.54:/tmp/bkp*tar.gz /home/...
asinix's user avatar
  • 105
0 votes
1 answer
312 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.
MrPigbot's user avatar
1 vote
1 answer
4k 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 ...
Bassam's user avatar
  • 13
2 votes
1 answer
1k 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.
Augusto Will's user avatar
0 votes
1 answer
307 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 ...
AlmostSerious's user avatar
0 votes
1 answer
668 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 ...
Bob D's user avatar
  • 3
0 votes
1 answer
242 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 --...
ManuelJE's user avatar
  • 195
0 votes
1 answer
243 views

Executing a script on boot in lubuntu 19.04 to connect to VPN (rc.local and crontab issues)

I am new to Linux and I am wondering how to make my virtual machine with Lubuntu 19.04 automatically connect to a VPN on boot. the VPN I chose is Proton VPN and I have to execute this command to ...
MrCont's user avatar
  • 1
0 votes
0 answers
50 views

Apache-tomcat stops at regular intervals

I need to start tomcat every morning. One thing I suspect is there is a crontab written to clear the Catalina.out at Midnight, does it lead to stopping of tomcat by any means? echo '' > /opt/apache-...
lancer's user avatar
  • 1
0 votes
0 answers
218 views

crontab -e run as root and not as user

When I am login as a user (lets say: John) to may linux (Ubuntu 18), I run the command: crontab -e I then entered a simple command: python pythonFile.py I was expecting the job to run under user "...
ZoRo's user avatar
  • 111
2 votes
1 answer
3k views

“Must be connected to a terminal.” in screen

I'am using a script for an automatic server restarts after crashes etc. It's a fiveM(GTA V) server. Everything is workin on crontab, and there are some lines in this script to check out if server is ...
MuDzYn.'s user avatar
  • 41
0 votes
0 answers
2k views

Run a cronjob on every month 2nd thursday [duplicate]

I want to generate a report by executing a python script. This script has to run on every 2nd thursday of a month, 3.30am . How to achieve this. Below code might work, if the dates are fall under 8-...
Darknight's user avatar
  • 109
1 vote
1 answer
314 views

Restart ea-tomcat85 from crontab

I have written a script to restart tomcat service # timestamp ts=`date +%m-%d-%Y_%H:%M:%S` echo "$ts: Restarting ea-tomcat85..." &>> /home/account_name/restartservice.log ubic restart ea-...
AL̲̳I's user avatar
  • 111

1
2 3 4 5
7