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
0 votes
0 answers
8 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/....
user avatar
0 votes
1 answer
18 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 ...
user avatar
1 vote
1 answer
88 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: */...
user avatar
  • 119
0 votes
1 answer
60 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 ...
user avatar
  • 25
0 votes
0 answers
18 views

Linux backup to local NAS using Anacrontab and Rsnapshot?

I've set up a backup of my Linux machine to a local NAS storage which is attached to a local network switch. My anacrontab is set-up to do daily backup every 1 day, weekly every 7 days, and monthly ...
user avatar
  • 645
0 votes
0 answers
57 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@...
user avatar
  • 43
0 votes
0 answers
24 views

Is there a way to test whether my cronjob is working?

59 0-1 * * /usr/bin/php ~/../home/scron/scronjob/script.php > /dev/null I have this inside /var/spool/cron/root, and I am wondering why it didn't run the last 5 days, because I deployed 5 days ago,...
user avatar
1 vote
1 answer
51 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 ...
user avatar
  • 111
0 votes
1 answer
23 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[...
user avatar
1 vote
0 answers
62 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: ...
user avatar
0 votes
1 answer
35 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 ...
user avatar
0 votes
1 answer
71 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. ...
user avatar
0 votes
1 answer
74 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 +"...
user avatar
  • 1
0 votes
1 answer
72 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 ...
user avatar
1 vote
1 answer
91 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 ...
user avatar
  • 295
0 votes
0 answers
19 views

How to auto open virtual Terminal and excute the commad in the terminal using Crontab

I want to ask about how we can auto open the virtual terminal and run a command in that opened terminal on centos 7 via Crontab. If cannot auto open, so can we run and display the command in the ...
user avatar
0 votes
2 answers
169 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 ...
user avatar
  • 177
1 vote
1 answer
483 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 ...
user avatar
  • 228
1 vote
1 answer
341 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 ...
user avatar
0 votes
1 answer
96 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 ...
user avatar
1 vote
1 answer
36 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 ...
user avatar
  • 2,522
1 vote
1 answer
224 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....
user avatar
1 vote
1 answer
494 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. ...
user avatar
  • 13
0 votes
1 answer
331 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 ...
user avatar
  • 1
0 votes
2 answers
150 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 &...
user avatar
3 votes
1 answer
196 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 ...
user avatar
  • 182
0 votes
1 answer
101 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) ...
user avatar
  • 173
1 vote
0 answers
334 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 ...
user avatar
  • 111
0 votes
1 answer
65 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 ...
user avatar
  • 101
0 votes
0 answers
47 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 ...
user avatar
0 votes
2 answers
169 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/...
user avatar
  • 105
0 votes
1 answer
156 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.
user avatar
1 vote
1 answer
2k 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 ...
user avatar
  • 13
1 vote
0 answers
506 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.
user avatar
0 votes
1 answer
213 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 ...
user avatar
0 votes
1 answer
205 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 ...
user avatar
  • 3
0 votes
1 answer
156 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 --...
user avatar
  • 185
0 votes
1 answer
199 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 ...
user avatar
  • 1
0 votes
0 answers
21 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-...
user avatar
  • 1
0 votes
0 answers
75 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 "...
user avatar
  • 111
1 vote
1 answer
1k 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 ...
user avatar
  • 31
0 votes
0 answers
920 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-...
user avatar
  • 109
1 vote
1 answer
210 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-...
user avatar
  • 111
0 votes
0 answers
75 views

Convert crontab commands to systemd?

I am using crontab in centos and I am having many problems such as some commands are not executed or simply not running any and simply deleting the crontab file and putting the same lines back is ...
user avatar
0 votes
1 answer
506 views

What effect is using /etc/cron.deny supposed to have?

Does adding a user to cron.deny deny cron jobs from running or the ability to edit the crontab file? The man pages say: Running cron jobs can be allowed or disallowed for different users. For ...
user avatar
0 votes
1 answer
480 views

how to add timestamp to file names when moving them to cloud storage using cron job in ssh

I have built an ftp server on google compute engine that receives data from on prem systems as csv. I want to move this data after receiving it to a google cloud storage using a cron job from the vm ...
user avatar
  • 45
3 votes
2 answers
2k views

Run missed cronjobs when computer turns on

I have some cronjobs running at certain times of the day but sometimes my computer is switched off when they are scheduled to run. Is there anyway for these to run as soon as the computer is turned ...
user avatar
2 votes
2 answers
2k views

script with "export" command in a crontab

I have this in cron tab: * * * * * /root/attente.sh and attente.sh : export attente=$(cat /root/switchboard.txt) If I run export attente=$(cat /root/switchboard.txt) in a shell it works but not in ...
user avatar
  • 23
0 votes
1 answer
133 views

Attaching to a screen session on boot

What I'm trying to do is start a screen session on boot via crontab and then have the user automatically connect to that session. Here's my current cron file: # Edit this file to introduce tasks to ...
user avatar
0 votes
1 answer
598 views

My production server was breached and I found this script. Is it a decoy?

A few days ago my VPS came under heavy load from spammers trying ssh attacks and script injections. I have since added new fail2ban regexps and new security measures for REDIS where it looks like they ...
user avatar

1
2 3 4 5
7