cron

Are directories such as /etc/cron.daily and similar restricted by naming rules?

Are directories such as /etc/cron.daily and similar restricted by naming rules? Mentioned in a comment in this post How are files under /etc/cron.d used?: People might miss, that "the file names must conform to the filename requirements of run-parts" (see Debian’s man cron). So filenames in /etc/cron.d/ which match the shell glob [!A-Za-z0-9_-] are ignored! …

Total answers: 1

Cron job with for loop, executing same command several times to create multiple threads

Cron job with for loop, executing same command several times to create multiple threads I’m trying to create a single-line /etc/cron.d/ cron entry, which runs the same command serveral times, essentially to create multiple threads, for long-running jobs: * * * * * usertorunas "for i in {1..6} ; do curl -s ‘https://www.example.com/path’ &>/dev/null & …

Total answers: 1

Environment variable LOGNAME or USER does not correspond to effective user id

Environment variable LOGNAME or USER does not correspond to effective user id I’m running an Ubuntu 20.04.6 LTS server. The server hosts some Virtualbox virtual machines that I backup with a bash script on a daily basis. That works quite fine. The bash script also sends some emails when the backup worked, or I get …

Total answers: 1

redirection operator now fails in cron job after migrating to cloud

redirection operator now fails in cron job after migrating to cloud I have a line like this on my cronjob: 22 9 * * 1-5 cd ~/execution/samples/Cpp/data_logger/; ./data_logger_static 127.0.0.1 $TWS_LIVE_PORT &> SPY-STK.csv It worked great and wrote a bunch of data to a file called SPY-STK.csv. However, I recently this to a remote server, and …

Total answers: 1

troubleshooting crontab not running

troubleshooting crontab not running From the log it seems like it tries to run at scheduled time Apr 29 10:00:01 momspi CRON[13324]: pam_unix(cron:session): session opened for user admin(uid=1000) by (uid=0) Apr 29 10:00:01 momspi CRON[13325]: (admin) CMD (./media/backup.sh) Apr 29 10:00:01 momspi CRON[13324]: pam_unix(cron:session): session closed for user admin Apr 29 10:00:01 momspi postfix/pickup[13242]: B432C89D70: …

Total answers: 1

Why is my crontab giving me a bad username error?

Why is my crontab giving me a bad username error? I’m trying to zip a directory and copy it over as a backup. I’m new to Linux to so I followed guides as best as I could, but when trying systemctl status cron I get the following error: Apr 27 13:34:01 mc-server cron[950]: Error: bad …

Total answers: 1

Multi computer cron

Multi computer cron I have many computers and I ssh between them. I have a single cron file, which I manually type after into each computer. And when I change this cron file, I have to manually ssh into each computer to update its cron accordingly. Is there any way to have each computers cron, …

Total answers: 1

Shutdown command vs cron jobs

Shutdown command vs cron jobs I have a number of computers and each computer is starting cron jobs left and right. Those are both server computers and desktop computers. On desktop computers it would be inconvenient if a user would shutdown the computer while a cron job is running. I am thinking of mv-ing the …

Total answers: 1

Scheduled a computer to reboot everyday at 7AM, not sure if I did it correctly

Scheduled a computer to reboot everyday at 7AM, not sure if I did it correctly Running Ubuntu 20.04, I have computers that I want to reboot everyday at 7AM. I followed these instructions, and I thought it was working, but now when I use the uptime command, it will often report longer than 24 hours, …

Total answers: 1

Start @reboot crontab script in a new tmux/byobu session and be able to connect to it

Start @reboot crontab script in a new tmux/byobu session and be able to connect to it I have a crontab entry that starts a backup job script after reboot: @reboot (sleep 120 && bash /srv/recvuser/cron_autostart.sh) 2>&1 | /usr/bin/mail -s "SuperServer ZFS Backup" my.mail@gmail.com This works. However, the script can take a while (1-2 days). In …

Total answers: 1

unable to mount external drive from cron (using udisksctl)

unable to mount external drive from cron (using udisksctl) GOAL I’d like to mount an external drive using cron for automatic backups, preferably with udisksctl. PROBLEM udisksctl mount -b /dev/sdXY works fine from the command line or shell script, but when I run it from cron (using my own cron table), it fails with the …

Total answers: 2

Script to notify via email when low on disk space

Script to notify via email when low on disk space I found the below mentioned script on the internet, which notifies via email when server gets low on storage or as per defined. I run it every 5 minutes, if i am low on storage it keeps notifying me with email after 5 minutes. What …

Total answers: 1

Cron, python and saving to a file

Cron, python and saving to a file I’ve got a veeery simple script written in python that tests my internet connection na saves parsed data to a json file: #!/usr/bin/python3 import subprocess, json, os from datetime import datetime # run the bash script and parse results def speedtest(): result = subprocess.run(["/bin/speedtest-cli", "–simple"], stdout=subprocess.PIPE, encoding="UTF-8").stdout # …

Total answers: 2

Crontab doesn't open for user

Crontab doesn't open for user When I am trying to open crontab I see the next output: ubuntu@macaroon:~$ crontab -l crontabs/ubuntu/: fopen: Permission denied When I add sudo it opens fine however, if the jobs don’t work there: ubuntu@macaroon:~$ sudo crontab -l # Edit this file to introduce tasks to be run by cron. # …

Total answers: 2

Why does my powershell script run with "pwsh" but doesn't with "sudo pwsh"?

Why does my powershell script run with "pwsh" but doesn't with "sudo pwsh"? I’m still somewhat new to Ubuntu / Linux so please bear with me if I’m not using correct terminology. I’m on Ubuntu 20.04 but I use Putty to perform everything via the terminal. I’m using a collection of shell scripts (.sh files) …

Total answers: 1

crontab -e stopped working for non-root user, /bin/sh: 1: mvim: not found, ubuntu 22.04

crontab -e stopped working for non-root user, /bin/sh: 1: mvim: not found, ubuntu 22.04 The command crontab -e has stopped working under non-root user accounts and gives the error: /bin/sh: 1: mvim: not found crontab: "mvim" exited with status 127 However, it still works for root with sudo. I don’t know what has changed, just …

Total answers: 1