All Questions
197
questions
0
votes
1
answer
77
views
anacron doesnt work as expected
Trying to schedule a job to run every day with cron or anacron. Search the forum for resolution but still without any success.
Changing shell=/bin/bash or bin/sh didnt do anything.
My system lubuntu
...
1
vote
2
answers
434
views
rsync - Operation not permitted when script is launched by cron
I've got a script that basically launches the following command
rsync -avh --progress --no-relative "$SOURCE_PATH/" "$DESTINATION_PATH"
and vice-versa (destination to source). ...
0
votes
1
answer
113
views
Run Command after Laptop unfold
I want to run a bash file at a specific moment a day. (8:00 and 20:00).
I've already managed to do this via crontab and also on startup if my computer was shut down at the time. My only problem is ...
1
vote
2
answers
1k
views
Running shell Script via Crontab
So I've tried to run a shell script via crontab.
My Crontabs look like this:
00 20 * * * $HOME/Bilder/Hintergründe/.background_skript/background_night.sh
and my background_day.sh looks like this:
`#!/...
1
vote
1
answer
692
views
How to tell which files are new or have been modified between calls of a script
I want to call a shell script regularly, and in it I need to process the files present in a directory tree that are new or that have been modified since the previous call of the script.
My 1st thought ...
0
votes
0
answers
137
views
CRON to Check if a webapp is working properly and report what happened if not
This is my first iteration in bash:This webapp does not have postgres but Apache 2.4, Tomcat 8.
I check first the 200 http response. Then if http server is running and if the tomcat also does.
I ...
2
votes
1
answer
204
views
list of files (ls /dev) is different when run on command line vs. via crontab
Why can't cron ls certain files in /dev using my script ?
The script can list /dev completely when run from the command line. The same script run from either cron setup cannot see (list, ls) most of ...
0
votes
2
answers
774
views
How to setup cronjob with automated emails in linux?
I've been working on creating a script to scan a series of mailboxes on a linux server, find ones that have more than 250 emails in the mailbox, and then send an email with the name of those mailboxes ...
0
votes
0
answers
53
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
1
answer
70
views
Cron Disrupting VBoxManage Commands
I am on Ubuntu 20.04 desktop, running Virtualbox 6.1 and I use Webmin to run a very simple cron job to take daily snapshots of my virtualbox test server as follows:
VBoxManage snapshot VminServer ...
0
votes
1
answer
133
views
wordpress automatic updates via cron no root privileges?
this script is run by update.sh wich is run by cron every day at 2 o'clock, it allows wordpress to be updated automatically via cli (needs to be installed before) actually runs fine, when run as root
...
0
votes
0
answers
204
views
git produces no output when called from script via cron (log/shortlog)
I've got a script git-test going to a local git repo and calling git shortlog to keep track of recent changes. For testing purposes, I just used these lines:
#!/bin/bash
cd /myrepo.git
result="$(/...
0
votes
0
answers
903
views
Why does cron log to auth.log every 30 minutes?
I have a virtual machine running Ubuntu with these cron settings, four jobs running once a day:
10 6 * * * cd $HOME/...
30 4 * * * mongodump ...
30 4 * * * . .bashrc && ...
10 4 * * * cd $HOME/...
0
votes
0
answers
159
views
Delete all directories on a ftp folder except ones I list cronjob?
Is there any way for me to delete all folders in a given ftp folder using a cronjob, and the deleted files are folders older than x hours, with a few specific folders that are not deleted that I ...
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@...
1
vote
1
answer
2k
views
Setting $DISPLAY with cron
I've been trying to get my screen to lock every half hour, and thus far it hasn't been effective, as cron (or technically my client, cronie) throws errors and does nothing. Errors below (sourced from ...
0
votes
1
answer
5k
views
"/bin/sh: 1: Syntax error: redirection unexpected" in crontab's outputs
In crontab I have this job script :
0 5 * * * /home/user/job_h.bash > /home/user/log_h.log > 2&1
where the job_h.bash contains :
#!/usr/bin/env bash
set -e
source /home/user/pyenv/test/bin/...
1
vote
1
answer
2k
views
Understanding how pgrep determines process IDs
I'm currently refactoring a script that works well if executed in terminal directly but exits early due to a process check if executed from crontab. This early termination is caused by code using a ps ...
1
vote
1
answer
945
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 ...
2
votes
1
answer
2k
views
Why is my script running if run with cli but not with crontab?
On WSL Ubuntu 20.04 I have two scripts (one sh and one python) that run perfectly if I launch them with bash, but not with cron.
The second (python) script is supposed to run just if the first (bash) ...
1
vote
0
answers
811
views
Ubuntu - Crontab seems to be running my script but not actually doing anything?
Ubuntu 18.04.5 LTS Bionic
sudo crontab -e
*/5 * * * * /bin/bash -c '/root/checker.sh'
checker.sh
#!/bin/bash
if ! (systemctl is-active varken.service)
then
/bin/bash -c 'service varken start'
fi
/...
0
votes
1
answer
403
views
rm -rf no longer deletes folder in cron job
I wrote a program that writes a large number of small files to a temporary directory, then, via a call from within the program, deletes the temporary directory. This program is called via a user-...
0
votes
2
answers
924
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 ...
0
votes
0
answers
41
views
bash script is not running
I have a Flask project running inside a kali vm, the webapp is running fine but I would like to run it at boot to be able to test it from another vm
created a .sh script
echo "Starting Flask ...
1
vote
1
answer
760
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....
0
votes
0
answers
19
views
Cronjob can't execute notify-send [duplicate]
I have the following file ~/.config/local_scripts/notifier.sh with this content:
#!/bin/sh
notify-send -t 10000 "Cronjob" "Test succeeded"
This is in my crontab, if I execute ...
1
vote
0
answers
1k
views
Copying a file while its being written to (in Linux)
I am in a year-long Twitter research project, and I collect tweets via Twitters API and Twarc.
In short, this writes a new tweet as a new line to one specified file, roughly one per second at night, ...
0
votes
0
answers
92
views
Can't install anything on my router shell
I know this might be a noob question or maybe not. I have an ssh shell with my router and I want to make a cronjob for the router to update the IP address of a DDNS provider(Dynu.com). I tried the ...
0
votes
1
answer
592
views
Cron job fails to run NodeJS script
I have a cron job for which I want to log output. The cron file (crontab -e) is:
0 7 * * * node $HOME/server/task.js >> $HOME/server/log.txt
The cron task is called:
$ grep CRON /var/log/syslog
...
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
613
views
Cron job doesn't work
I have a shell script which I want to run as a cron-job every 10 minutes. I'm adding the job as follows
crontab -e
*/10 * * * * /bin/sh /home/tool/fill_data/run_script.sh
And the run_script.sh ...
1
vote
1
answer
1k
views
Cron scheduled backup script not working or writing to log file
I have a duplicity backup script set to run once per day through the root cron tab.
I set it up like this:
sudo crontab -e -u root
and added the line:
00 03 * * * root /home/[myusername]/...
0
votes
1
answer
169
views
Cron jobs do not execute
I have 3 python scripts which are scheduled in the same crontab as :
# Script 1
0 0,6,12,18 * * * cd path/to/script && /usr/bin/python3.8 -W ignore script1.py >> file1.out
# Script 2
0 ...
1
vote
0
answers
159
views
Reattaching a screen in a crontab to wait until the screen closes returns "Must be connected to a terminal."
I use a bash script to backup a minecraft world, which is called from a crontab every day. Though the backups are made just fine, I've found an error message in the output:
Must be connected to a ...
1
vote
0
answers
1k
views
Start tcpdump with script on system start
I'm trying to run a script on startup that runs the tcpdump command on Centos 7 and Centos 6.
The aim is to start a rolling pcap when the system starts.
I've tried using a cron with @reboot, but it ...
0
votes
1
answer
675
views
Cron call to script giving errors, while executing script normally doesn't
I have been having problems with executing a script every second with Cron.
This is in my cron file:
* * * * * /var/webconfig/test.sh
and this in my test.sh :
#!/bin/bash
cd /root/python-example ...
1
vote
0
answers
882
views
permissions issue when running rsync via crontab
I'm using rsync to backup directories on my local machine to a remote server. I have SSH key-based access set up and working for my user, so when I run the command:
rsync --update -razvP --progress ~/...
1
vote
1
answer
44
views
Ubuntu Shell: Use cron to run 3 scripts consecutively, second must remain running in the background
I've come across the following scenario in one of the servers I recently have to manage. Its an Ubuntu used as a music streaming server, the music must be changed according to an schedule but the last ...
0
votes
3
answers
1k
views
How to delete a file owned by different user using a bash script?
I have a bash script that should remove a file from /tmp. Problem: the file is created my user mysql during SELECT INTO OUTFILE export. Thus the script-running user does not own the file.
Still, how ...
1
vote
1
answer
848
views
Linux - run script every 5 mins as long as user is logged in
I need to run a script when a user logs in and need to run the script every 5 minutes as long as the user is logged in. Script should run within the users security context and should stop running when ...
4
votes
1
answer
12k
views
How to Create CRON Jobs that Require SUDO Permissions
I'm on Ubuntu 19.04 (Disco Dingo). I've added my regular user acc. in SUDOERS and only use root when I'm bound to.
Now, I've created a basic script to automate my updates and free up some space. It ...
5
votes
1
answer
17k
views
crontab job log message shows a error status 0x004b from mta#012
The crontab job log message shows a error status 0x004b from mta#012 when I try to check my crontab job.
# grep CRON /var/log/syslog
[...]
I get this log:
Nov 26 08:00:01 stiitsrv9 CRON[26109]: (...
1
vote
2
answers
549
views
Cronjob fails with “ipset not found” but runs flawlessly on command-line
When I call a script from a (root) cronjob it fails with the message 'ipset not found'. Here is the problematic script line:
for i in $(cat /etc/cn.zone); do ipset -A china $i; done
Some lines ...
0
votes
1
answer
292
views
"Multiplexing" stdout and stderr in /usr/bin/logger
I recently found out about /usr/bin/logger and I find it very good.
I noticed that it contains a priority argument (-p) (facility.info, facility.alert, etc..).
So if I want to log just stdin I do it ...
0
votes
0
answers
242
views
Cronjob in background
I have a bash script already tested and working fine. It's a listener that trigger a command on new created files in a specific directory. I added it in crontab "* * * * * root /bin/bash /var/...
0
votes
1
answer
3k
views
No output in shell from Echo
I'm looking to modify a script I have to stop it running at a certain time in the day whilst my machine reboots. I've found the following suggestion which seems to fit the bill perfectly but for some ...
2
votes
2
answers
3k
views
File descriptor 3 leaked on vgcfgbackup invocation. Parent PID: bash
I'm using bash script to make backup of ubuntu machine with lvm, and then upload it to google drive, script runs every day via cron, without issues, but log file contains following error:
File ...
0
votes
1
answer
900
views
Rsync over ssh in a cron job: connection fails
I have created a script in order to backup my files over ssh. The authentication method used is an rsa key without password.
#!/bin/env bash
LOG_FILE="/home/toto/bin/backups.log"
DEST="/dest/"
IP=10....
0
votes
1
answer
33
views
Executing the commands stored in a crontab
I have setup a few commands to run every night using cron. When I don't leave my laptop running overnight, these commands will not be executed. I can't use anacron because it's not available on my ...
0
votes
1
answer
56
views
Cron job schedule to strem via RTP audio file
I have Asterisk 1.8.28 based PBX and I want to Intercom or Page some audio files at different times daily, I have Cisco SPA508G working as RTP receiver connected to my amplifier and bunch of speakers, ...