cron

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

xterm: Xt error: Can't open display: :0

xterm: Xt error: Can't open display: :0 I have a cronjob that didn’t work this morning. The line in crontab -e looks like this: 20 9 * * 1-5 export DISPLAY=:0 && /bin/bash /opt/ibc/twsstart.sh I couldn’t find any errors in /var/log/syslog, but when I try to run that command in my terminal, I get the …

Total answers: 1

What is the meaning of a trailing hyphen in this crontab command?

What is the meaning of a trailing hyphen in this crontab command? I was looking into how to programmatically add a cronjob, and came across this SO question which advises using the following one liner: (crontab -l 2>/dev/null; echo "*/5 * * * * /path/to/job -with args") | crontab – What does the trailing – …

Total answers: 1

cron command not working

cron command not working As a super-user I crontab -e and add a line to source a cronsh.sh file like this: 0 0 * * * source /home/myname/cronsh.sh The content of the cronsh.sh file is this line: date >> /home/myname/cronlog.txt However when I check the cronlog.txt file the next day, it’s empty. What am I …

Total answers: 1

CLASSPATH in crontab

CLASSPATH in crontab I am having trouble getting my Java program to run from cron. I am able to recreate the problem, using a simple example, as explained below: In the file /path/to/javaenv.txt I define my CLASSPATH variable as follows: export CLASSPATH= "/path/to/dir1": "/path/to/dir2": "/path/to/dirn": "/path/to/jar1": "/path/to/jar2": "/path/to/jarn" From the command line I am able …

Total answers: 1

cron: 5/15 * * * * doesn't work

cron: 5/15 * * * * doesn't work (run every 15 minutes starting from 5 minutes past the hour) */15 * * * * works fine by running every 15 minutes starting from the top of the hour. I need a task to run every 15 minutes starting from 5 minutes past the hour. Several …

Total answers: 3

Crontab with script to notify-send

Crontab with script to notify-send I’m trying to set up a bash script which is send a gui notification when a file is created in a folder. Everything works when I launch it in terminal, but when I set up at boot with crontab, the script is running but the notification doesn’t show on gui. …

Total answers: 1

endless reboot of ubuntu 20.04

endless reboot of ubuntu 20.04 I use Ubuntu 20.04.5 LTS with bigbluebutton. Yesterday at 8 am, ubuntu started to reboot uncontrollably every 9:27 minutes. I searched the Internet in a search engine, did everything possible, and even tried to disable shutdown, halt, power off, reboot. Everything I found and think is suspicious: root@bbb-server:/home/user# cat /var/log/syslog …

Total answers: 1

Cron not working in the new EC2 instance. If run manually then it's working

Cron not working in the new EC2 instance. If run manually then it's working I have set up a new EC2 instance. Everything is working perfectly. Now this morning I have set the cron and below is an example of cron */5 * * * * /usr/bin/php https://www.xyz.in/api/cron/index.php I have tested so many times but …

Total answers: 1

using a cron job to automatically backup the same drive using dd

using a cron job to automatically backup the same drive using dd so I want to backup my system drive (full drive not just partition) every month using dd, in an external hard drive. So I have something like this in my crontab 0 9 1 * * dd if=/dev/sda | gzip -c > /mnt/5E13119070E2D202/Backups/system_drive.backup.img.gz …

Total answers: 1

Unable to run notify-send from cronjob

Unable to run notify-send from cronjob In my Kubuntu 22.04, a script run by my crontab uses notify-send. However, it doesn’t work: there is no pop-up appearing. If I redirect the output (stderr in particular) of the script to a file, this error is printed: Error calling StartServiceByName for org.freedesktop.Notifications: Timeout was reached If instead …

Total answers: 1

Cron Job created by script to run another script on reboot – not working

Cron Job created by script to run another script on reboot – not working I’m trying to have a script create a cron job that executes another script on reboot. For reasons I am yet to understand, I cannot get this to work. For the sake of simplicity, this is the snippet I cannot get …

Total answers: 1