Questions tagged [cron]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
1k views

Is there a way of seeing the CPU usage of the programs in crontab?

I have a 30+ scripts that are run by the crontab at certain intervals, varying from every 30 minutes to once a month. I would like to know if I can see how much drain they cause when they are running? ...
0
votes
1answer
36 views

CRON job autostart validation

DDNS update is performed from the script duck.sh: chmod 700 duck.sh Open the crontab editor crontab -e A cron process runs the script at 5 minute intervals */5 * * * * ~/duckdns/duck.sh >/dev/...
0
votes
0answers
8 views

How to do a Cron.d permission review to ensure sensitive files and directories are secured?

Did an extraction for Linux system audit and is quite confused over the results. If I want to review the cron.d which line should i really be looking at? /etc/cron.d: total 20 drwxr-xr-x. 2 root ...
1
vote
1answer
42 views

Bash condition that won't run on first Thursday of the month

I have a cron that runs a script twice a week (Monday/Thursday) - this runs fine, but I need to stop it processing on the first Thursday of the month. I'd like to adapt this code: we=$(LC_TIME=C ...
1
vote
3answers
9k views

BashScript works from Terminal but not from CronTab

I've got a bunch of CronJobs, and they work fine, except for one. I've looked through a lot of forums and websites, and tried a combination of things but alas nothing has worked. Rephrasing the ...
16
votes
4answers
33k views

how to set crontab PATH variable

I had a problem running a script from crontab. After some research I understood the problem was because PATH parameter doesn't include /sbin. I looked what it does include in /etc/crontab: PATH=/...
0
votes
2answers
1k views

Unix 11i v2 Script to detect new files within directory

I was hoping someone can point me in the right direction. I would like to create a script to check for new files (files with today's date) within a directory and then print the results to a text file. ...
0
votes
2answers
1k views

NTP issues on Nagios server

Our Nagios server NTP has isn't working right. First here is the issues: root@ccsd-lx-noc03 /var/log> tail -n 10000 messages | grep "NTP" Jul 5 16:19:36 ccsd-lx-noc03 nagios: SERVICE ALERT: ...
0
votes
0answers
7 views

rclone to Google Drive: sync to the top level of Drive?

I've discovered rclone as a way to emulate (mostly) what Google Backup & Sync does on a W10 OS, combined with a cron job setup. So at the moment I'm experimenting with the Drive of a Google email ...
40
votes
2answers
3k views

Suspicious crontab entry running 'xribfa4' every 15 minutes

I wanted to add something to my root crontab file on my Raspberry Pi, and found an entry that seems suspicious to me, searching for parts of it on Google turned up nothing. Crontab entry: */15 * * * ...
2
votes
1answer
2k views

a cron job to delete a specific file once it reaches more then 1gb size?

My server broke down with exenstive damages when a log file reached 27 gigs in a few hours. Log files are compressed daily, and are usually very small, maybe up to 10mb in 24 hours. Today there was an ...
2
votes
1answer
2k views

Managing cron jobs across multiple servers

We are facing a problem with managing cron jobs over multiple servers with dependencies. I hope there is an opensource central management project that I can be used to handle that and report the ...
48
votes
8answers
51k views

cron ignores variables defined in “.bashrc” and “.bash_profile”

I have defined "SHELL" variable in /etc/crontab file: [martin@martin ~]$ grep SHELL /etc/crontab SHELL=/usr/local/bin/bash [martin@martin ~]$ file /usr/local/bin/bash /usr/local/bin/bash: ELF 32-bit ...
1
vote
1answer
2k views

Run python code from cron in an Anaconda environment

I need to run a python script using a specific anaconda environment, since I need to execute this script several times per day I would like to do it using the linux crontab file (/etc/crontab). When ...
0
votes
0answers
33 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
46 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 ...
7
votes
6answers
1k views

Detecting cron tasks run by another user

I am currently working through the Nebula challenges on exploit-exercises.com, and one of the challenges relies on a script being run by cron. This is run by another user (flag03) and the user I am ...
8
votes
3answers
28k views

Where is my logfile of crontab?

no /var/log/cron ,no /var/log/cron.log on my debian7 ,Where is my logfile of crontab ? ls /var/log/cron* ls: cannot access /var/log/cron*: No such file or directory
4
votes
1answer
2k views

How do I allow crontab use for local accounts that don't allow interactive logins?

Ok, here's the situation (you're welcome for the earworm): I am running a multi-server RHEL 7 environment with SELinux enabled. Due to DoD STIG controls, I do not have root access, but I do have a ...
0
votes
1answer
25 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
15 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 ...
1
vote
1answer
2k views

Logrotate not picking up or acting on new configuration file

I had a logrotate configuration file set up for a log (let's call it Log1). It is working fine and the log is rotating everyday as expected. Yesterday I cloned this set up and modified it for three ...
0
votes
1answer
30 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. ...
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
0answers
27 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 ...
0
votes
1answer
137 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 │ ├── ...
3
votes
3answers
2k views

Cron Authentication Failure error in Linux?

I was bogged with an error “Authentication Failure” for all of my cron jobs in Linux Ubunutu. root@Test:~# tail -f /var/log/syslog | grep cron Dec 11 16:38:01 Test cron[14861]: Authentication failure ...
0
votes
2answers
24 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
0answers
15 views

Oracle being listed under Cron.allow [duplicate]

I can see that oracle is under cron.allow, what does it mean? ==================================================== CHECK_BEGIN: DO_CRON ==================================================== ==========...
6
votes
4answers
4k views

Who starts unattended-upgrades?

I'm wondering who starts unattended-upgrades in my debian-jessie: my man page DESCRIPTION This program can download and install security upgrades automatically and unattended,...
-1
votes
0answers
28 views

Test a Cron job for a different day

I'd like to test a script that is fired from cron, that is dependent on what day it is. If it's Sunday, for example, it does one thing. If it's the last day of the month, it will do another. I can't ...
1
vote
1answer
54 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
34 views

Interpreting cron output

==================================================== ==================================================== CHECK_BEGIN: DO_CRON ==================================================== =====================...
5
votes
3answers
10k views

variables in crontab

On our linux server we have a lot of entries. Many entries look like this: 15 13 * * 3 /very/long/path/to/binary/run.sh ... These entries would be easier to maintain if I could write: 15 13 * * ...
3
votes
2answers
1k views

Log crontab shell script errors with error occurred time?

A common way to log crontab errors looks like below: 1 */8 * * * sh /pseudo_path/test.sh 2>> my_err_log It's a concise command, but it can't record the error occurred time, and the path of ...
0
votes
0answers
31 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
4k views

Cron stopped logging to /var/log/cron.log

A month ago I set cron to log to /var/log/cron.log by modifying /etc/rsyslog.d/50-default.conf. Logging worked great until I changed permissions on /var/log (by easing permission restrictions), and ...
0
votes
1answer
55 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
1answer
51 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 ...
0
votes
0answers
28 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
30 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
41 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
2answers
84 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
29 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
11 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
49 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
15 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?
0
votes
0answers
29 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
51 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, ...
1
vote
2answers
41 views

Shell way to get specific text based on condition

Using shell script I am making a db call on database VM and I am getting and storing the query response into a .txt file. Which looks like below: X folder Check: Number of Files on X Outbound 17 Y ...