Questions tagged [cron]

Cron is a job scheduler that allows users to run commands periodically.

Filter by
Sorted by
Tagged with
0
votes
1answer
678 views

Error: unable to access jarfile when running script from crontab linux

I have a .sh script that runs a python script that runs a jarfile. I want to run it from crontab. I created a log for the crontab and I get this error: Error: Unable to access jarfile ...
0
votes
2answers
69 views

Sh script not running in crontab but running manually with ./ [duplicate]

I have a .sh script that I've put in crontab with this command: 0 * * * * /root/Linux/lansare.sh It doesn't run even though I made the script an executable. I checked it and it has x. I tried before ...
0
votes
1answer
54 views

make remote backup copy of a file belonging to root

I have created a somewhat clumsy solution and I really don't like it, I would like to improve it. Here is the problem: I have a headless server that maintains a database that is stored within /root/....
0
votes
0answers
17 views

cron configuration files difference [duplicate]

I was trying to figure out what triggers daily dumping of a DB on an old Debian server. Of course the first thing to look at was crontab, so I used # crontab -l The output shows active cron jobs for ...
0
votes
0answers
10 views

mkdir with current date on remote server not working [duplicate]

I'm setting up a cron task which makes each day one carpet with the date. The code is simple: mkdir /mypathtofolder/foldername_$(date +'%m_%d') And it works in gitbash and linux, but when it's ...
0
votes
1answer
40 views

Create tunnel on boot via remote connection

Here is my situation: A. I have a dashboard server that restarts several services on 6 linux servers remotely on click certain buttons. B. I have multiple DB servers: two on dev, two on production. ...
1
vote
0answers
77 views

cron is truncating environment variables containing a hash

I export my environment variables with env >> /etc/environment to expose them to my cron jobs. However one of my environment variables, a password, contains a hash sign #... Sure enough, when ...
1
vote
1answer
1k views

Unauthorized access to cron

I was hacked this morning! Does anyone have an idea of what the entry of the crontab below might mean? 1st They created a dir structure .rsync/ ├── a │ ├── a │ ├── anacron │ ├── cron │ ├── ...
0
votes
2answers
32 views

I want to run my script as different user automatically when system start or reboot

I have created new user as newUser using sudo adduser newUser sudo i also set a password for it using sudo passwd newUser now what i want is to run a script from this newUser just say i created a ...
2
votes
1answer
61 views

Edit sh script before a cron job starts running

I do not have much experience in Linux and would like some insight into whether there is a possibility to change a variable within a script before it is automatically started through a Cron Job. For ...
0
votes
1answer
50 views

Interpreting cron output

==================================================== ==================================================== CHECK_BEGIN: DO_CRON ==================================================== =====================...
0
votes
0answers
317 views

Running crontab by a nologin user [duplicate]

I want to be able to have crontab run by a system or nologin user in centos 7.6 I have setup a user with the -r option: useradd -r my_nologin and have created a crontab for them: crontab -u ...
0
votes
1answer
308 views

Create cron job programmatically from php script

I have Raspberry Pi with Raspbian installed on it. I need a cron job that needs to have a variable time period (every 10, 20, 30, 40, 50 or 60 minutes). I found out the easiest way to create new cron ...
0
votes
0answers
29 views

Under what permission root crontab is being executed?

I have a weird problem. I have some task in my root's crontab: root@confluence:/home/ubuntu# crontab -l 0 4 * * 0 AWS_HOSTED_ZONE_ID=__ACCOUNT_ID__ /usr/bin/lego --domains example.com --path /etc/...
1
vote
1answer
39 views

rsync fails only when initiated via cron

I'm attempting to rsync files to my local machine from a remote server on boot via a crontab entry. My rsync script waits for resolv.conf to be configured by DHCP processes, then begins the rsync. ...
0
votes
1answer
109 views

how to add timestamp to stdout and stderr from a crontab job?

I want putting timestamp traces into two different files when I call to the script from a cron task. One file is for stdout script.log and another for stderr script.err With this cron line I get ...
0
votes
1answer
116 views

Cron entry to pass the value to script

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below: File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)" Now I ...
1
vote
2answers
595 views

$(hostname) doesn't work in cronjob

I have a simple backup script with this line to come up with a name for the backup: backup=$(/bin/date +'%Y-%m-%d_%H:%M_%S')_$(hostname).gz It works great when I run it under the root user. ...
-1
votes
1answer
141 views

Does cron not expand environment variables?

I found that setting my crontab PATH=/home/toothrot/bin worked, but $HOME/bin did not. And I checked that $HOME is set as expected. Does cron not expand environment variables? I tried using it by ...
0
votes
0answers
12 views

Running a script as if through cron [duplicate]

I find that a certain script works when run from a shell but not when run as a cronjob. How should debug this without having to wait for the next whole minute every time I want to see its output?
1
vote
0answers
632 views

Multiple Processes getting stopped with error “Resource temporarily unavailable” and “can't fork” resulting in crash

We are running a script on Dell Edge gateway 3002 to send data to cloud, but after running for 4-5 days the gateway becomes unresponsive(hanged state) and can't be pinged. The gateway has Ubuntu 18.04....
0
votes
0answers
19 views

What's the relationship between of /etc/crontab and /etc/cron.d/<somefile> [duplicate]

I know that /etc/crontab is for system cron jobs. But what about the ones in /etc/cron.d/<file-name>? Do cron automatically considers files in /etc/cron.d system cron jobs?
1
vote
0answers
192 views

systemctl not working in cron

I need to restart one of my services regularly, I tried to to put this into my crontab: 0 0 * * * systemctl --user restart bot I found that it doesn't work, after a few days when I check the ...
1
vote
2answers
62 views

Why does @weekly work as it does? Mistake in manual?

The crontab(5) manual says: Commands are executed by cron(8) when the minute, hour, and month of year fields match the current time, and when at least one of the two day fields (day of month, ...
0
votes
1answer
32 views

Compile in a single log all .log that shows Error message

I have many generated logs in /var/opt/log_loc1,/var/opt/log_loc2, /var/opt/log_loc3 from different cron jobs. Instead of looking in each log, is there a way to schedule a cron job that populates the ...
0
votes
1answer
274 views

Any way to quickly disable/renable cron jobs?

I currently have 50 cron scripting jobs created on crontab -e. These scripts check that various services are running. Sometimes when I'm testing the functionality of one service this requires me to ...
2
votes
1answer
251 views

Kali linux - Crontab @reboot is not executing

I'm on Kali Linux with VERSION_ID="2019.3" uname -a Linux kali 4.19.0-kali5-amd64 #1 SMP Debian 4.19.37-6kali1 (2019-07-22) x86_64 GNU/LINUX Trying to execute adjust_timezone.sh placed in /...
1
vote
2answers
463 views

Restart application after crash

I have some application (net core 2.1 app) which I run like this: nohup dotnet publish/TestApp.dll This application crashes sometimes, and I need to restart it when that happens. What do I need to ...
0
votes
1answer
543 views

Cron error: /bin/sh: 1: 6: not found [closed]

I want to run the Cron Job to do a very simple test. I wanted the command echo "hello" to be run from cron. However, everytime I run it I get the following error: Return-Path: <bitnami@ip-172-26-...
1
vote
0answers
131 views

reboot causes device to shutdown but doesn't start again for many hours after

I am using a BeagleBone running Debian. I have a cron entry in /etc/crontab which tells the device to reboot at 03:01 every night as follows 00 03 * * * root /sbin/shutdown -r +1 >> /...
0
votes
0answers
26 views

Linux booting hours after crontab reboot entry

I am using a BeagleBone running Debian. I have an entry in /etc/crontab as follows which tells the device to reboot every night / morning at 03:01 : 00 03 * * * root /sbin/shutdown -r +1 >&...
0
votes
1answer
50 views

CRON Job Schedule issues

I want to schedule a job for 3rd Friday of every month, 1 AM . I checked few cron entry websites for that didn't work for me. I was also checking for some awk options for this so far not successful ...
-2
votes
1answer
101 views

Is there a reason to use \+ or \- in date arguments?

I use date \+%F\-%T to show date and time in this format: 2019-08-15-21:34:58. From man date: %F full date; same as %Y-%m-%d %T time; same as %H:%M:%S I recognized no explanation for \+ or \...
0
votes
0answers
34 views

script runs under my user but fails under root and cron

Using some google and questions, I made this bash script if [[ $(curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | ...
-2
votes
2answers
97 views

How to tar all newly generated files in a directory every two hour and moving that tared files to another directory

files will generate every 5th minute in /kit directory.Want to tar all the files and move that files to /kit/bkp directory every 2 hr
0
votes
1answer
616 views

Sending Output of Script By mail

I have a script to Monitor servers in Production , and I want to receive the result of this script execution every 2 hours by mail , how can I do this ? someone has an example ? this is my Script: ...
0
votes
0answers
24 views

Awk problem in Cron VM.drop_caches=3 [duplicate]

I have some problem with the cleaning of the vm cache and AWK. I have one script who runs in cron.hourly (drop.cache) who said: sync; sysctl vm.drop_caches=3 The problem is for some reason the ...
0
votes
0answers
44 views

Awk and vm.drop_caches issue in cron hourly

I have some problem with the cleaning of the vm cache and AWK. I have one script who runs in cron.hourly (drop.cache) who said: sync; sysctl vm.drop_caches=3 The problem is for some reason the ...
0
votes
2answers
47 views

My script doesn't run according to cron schedule

I have made (with a Stack Exchange help) a script that checks if the web application is available and restarts the web app daemon in order to get it running again (usually helps until I'm at work). It'...
-1
votes
1answer
74 views

tput in a cron job does not output bolded text [duplicate]

I comeback with a very strange behavior when we run this command on Linux redhat machine echo "$(tput bold)" start write to log "$(tput sgr0)" >> /tmp/log.txt we get ended bold text in /tmp/...
1
vote
1answer
243 views

Slurm on desktop computers, how to prioritize the owner

In short: On a Slurm cluster, I need some computers to be available and responsive to their respective owners during work hours. Problem: I manage a small (but growing) heterogeneous cluster with ...
0
votes
0answers
91 views

Different output between command line and crontab

I'm trying to send an alert whenever a connection between 2 different machines gets lost. Basically I need to see from PC N°2 if there is an established connection from PC N°4 to port 6031 on PC N°5. ...
7
votes
3answers
346 views

tracking crontab changes with git

I would like to use git to track changes in crontab. I have initialized a new git repository in /var/spool/cron/crontabs/ Now the problem is, when crontab is saved, the second line of the header ...
1
vote
0answers
128 views

Can logrotate create missing files?

I was looking through the logrotate directives, and it seems that create will only create a new log file after rotation. I just get an error if the log file is missing. Is there a way to trigger ...
1
vote
0answers
99 views

crontab: waitpid() failed waiting for PID xxx from “/usr/bin/sensible-editor”: No child processes

I have a problem similar to this one: after running crontab -e and exiting the editor (mcedit), the temp file is not saved, and the screen gets filled with a repeating error message: crontab: ...
0
votes
1answer
29 views

Cron logs show activity, but app logs show nothing

I'm trying to run a daily cron app. What I did: crontab -e Inside file, I have: 0 0 * * * cd /home/ec2-user/myapp && docker-compose up when I check /var/log/cron, I get: Jul 29 00:00:...
0
votes
0answers
12 views

How to temporarily suppress part of a monitoring task/event

I need to monitor a daemon every few minutes with a command and analyse both the exit code and the (multi-line) output. In case there is a problem I want to be notified one time, but I don't want to ...
0
votes
1answer
182 views

sed to remove leading comment on crontab with Sun Solaris 10

I am writing a sed command that should uncomment an entry in crontab on sun Solaris 10. I have tried 2 ways and they are working on Ubuntu but they didn't work on Sun Solaris 10; it returns sed: ...
0
votes
1answer
73 views

Shell script for crontab entries

i was asked to write shell script to perform the following task: update cronentry from \*/15 * * * * /bin/sh /opt/myscript/myscript.sh > /tmp/myscript.check.out to \*/30 2,4,6 * * * /bin/sh /...
2
votes
0answers
188 views

User input in cronjob

I have created a script which calls another script.I'm implementing this via below cronjob 55 12 * * * cd /backup2 && ./script2.sh The another script ,I'm calling(restore1.sh) requires ...

1 2 3
4
5
38