Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cron]

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

-1
votes
1answer
34 views

Install a package manually -Debian [on hold]

I am working on a customized Linux Debian (Debian 4.9.2-10) server. I would like to install crontab, which is not installed in the system neither its letting me configure it using the apt or dpkg ...
-2
votes
1answer
36 views

apt-get install program crontab -e job [on hold]

I have problems installing the program 'pxz' using a script executed in crontab. The script: VERSION=$(lsb_release -ds) if [ "$VERSION" = "Ubuntu 14.04.3 LTS" ]; then apt-get install pxz --...
-1
votes
2answers
34 views

cp command throwing error in crontab [duplicate]

I have the following command in my crontab to copy a file named 'data' into an existing directory named 'Archive', with a date stamp appended to it. When I run it on the command line manually, it ...
0
votes
0answers
23 views

What is wrong with my Logrotate file?

I've created a relatively simple logrotate file to rotate all tomcat access.log files daily, up to 5 times: /opt/projects/tomcat/instance_*/logs/access.log{ rotate 5 compress ...
-3
votes
0answers
21 views

Kali Linux - VMware - After spoofing my MAC address, i am not able to connect to internet [duplicate]

After automating @reboot macchanger with crontab -e, i ran into a problem, i can no longer connect to internet. in crontab -e i wrote: @reboot macchanger -r eth0 Then when i reboot my MAC address ...
-1
votes
2answers
62 views

Is there any disadvantage of making software update and upgrade automatic? [closed]

On Lubuntu 18.04, Software Updater notifies me there is update available from time to time. If I happen to have the time to, I will manually run sudo apt update; sudo apt upgrade. I am thinking about ...
0
votes
0answers
26 views

How can I make cron log standard output to a file, but email me if there's an error

I thought this would do it: 0 5 * * * /home/backup.sh >> /home/backup.log (backup.sh contains "/root/gsutil/gsutil -m rsync -r /home/data/. gs://my-data") My understanding is that any ...
-2
votes
0answers
25 views

How to schedule testng.xml to run every day at 8pm using crontab?

I have scripted a Selenium script. I need the script to run everyday at 8pm. I somehow managed to run the script on the linux terminal. Path would be like: cd /home/kasturi/workspace/sims. And the ...
1
vote
1answer
43 views

Why not allow all users to schedule jobs with crontabs? [closed]

By setting /etc/cron.allow and/or /etc/cron.deny it's possible to restrict what user is allowed to use crontabs to schedule a cron job to run as that user. At least at my office our SAs default to ...
0
votes
0answers
13 views

Why can I not run KDE redshift in a cronjob? [duplicate]

I'm running KDE Neon 5.14 (based on Ubuntu 18.04) and KDE Plasma 5.14.2. A command redshift (/usr/bin/redshift) is provided to adapt the screen colors to red tones for evening/night. I can ...
2
votes
2answers
77 views

Why does cron use MTA to send emails, while we use MUA to send emails?

I have looked at the definitions of MTA, MUA, MDA, for example, https://ccm.net/contents/116-how-email-works-mta-mda-mua and https://en.wikipedia.org/wiki/Email_agent_(infrastructure) In Lubuntu, the ...
0
votes
1answer
38 views

Cron.d not running (rsnapshot)

Yesterday I've configured rsnapshot on a debian 9 machine, but the cron's I've set for the backups in /etc/cron.d/rsnapshot are not being executed. Also, after I save & close the /etc/cron.d/...
1
vote
1answer
68 views

Where does cron log by default?

On Ubuntu 18.04, man cron says cron logs its action to the syslog facility 'cron', and logging may be controlled using the standard syslogd(8) facility Also, the default configuration of ...
-3
votes
0answers
19 views

How does cronie set `PATH` with and without -P? [duplicate]

In cronie's crond manpage -P Don't set PATH. PATH is instead inherited from the environment. What does "PATH is instead inherited from the environment" mean? ...
0
votes
1answer
45 views

How does cron set the environment variables in /etc/cron.d/* and /etc/cron.d/?

In Debian's manpage of cron, The files in /etc/cron.d/ are independent of /etc/crontab: they do not, for example, inherit environment variable settings from it. and from the LinuxQuestions.org ...
0
votes
1answer
44 views

why does the cron daemon make efforts about recording output when executing a cron job, instead of using redirection inside the job?

The manpage of cron says When executing commands, any output is mailed to the owner of the crontab (or to the user specified in the MAILTO environment variable in the crontab, if such ...
3
votes
2answers
189 views

What is `-p` used for `cron`?

In cron's manpage (cronie) -p Allows Cron to accept any user set crontables. I learned that cron daemon will implicitly search for and run the cron jobs defined in /etc/crontab, /etc/cron.d/* ...
0
votes
2answers
41 views

user specific jobs vs system jobs running as specific users

On Debian and its derivatives, how shall we understand the following seemingly contradictory facts: /etc/crontab and /etc/cron.d/* have a user field, meaning that a job is running as the user (either ...
0
votes
2answers
51 views

Can I manually create and edit `/var/spool/cron/crontabs/t` without `crontab -e`?

I heard that /etc/crontab and /etc/cron.d/* can only be edited manually without crontab command from How would you edit `/etc/crontab` and files under `/etc/cron.d/?. Do I need to run crontab -e to ...
0
votes
1answer
31 views

Does cron modify execution environment and make tor servce not change exit node?

According to https://unix.stackexchange.com/a/478636/674, cron modifies the execution environment to execute a job. When I run sudo service tor reload twice directly in bash, it always shows two ...
-3
votes
2answers
44 views

Is it true that “cron.daily runs anacron everyhour”?

On Ubuntu, what is the calling relation between cron and anacron? I am confused by looking at /etc/anacrontab, /etc/cron.daily/0anacron and /etc/crontab. From https://askubuntu.com/a/848638/1471 ...
1
vote
1answer
46 views

Differences between `/etc/crontab`, files under `/etc/cron.d/` and `/var/spool/cron/crontabs/root`?

What is the difference between the purposes of /etc/crontab files under /etc/cron.d/ /var/spool/cron/crontabs/root If you want to add a cron job, into which file would you add it? manpage of cron(...
1
vote
1answer
40 views

Are cron tasks in `/etc/cron.d/` files supposed to not contain `sudo`?

In /etc/cron.d/myjob, I create a cron task of running a bash script and redirect its stdout and stderr to a log file. The script contains a line of sudo running a command. In the log file: sudo: no ...
0
votes
1answer
30 views

How would you edit `/etc/crontab` and files under `/etc/cron.d/?

In my /etc/crontab # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/...
0
votes
4answers
53 views

How can I find out cron implementation on Ubuntu?

Wikipedia says With the advent of the GNU Project and Linux, new crons appeared. The most prevalent of these is the Vixie cron, originally coded by Paul Vixie in 1987. Version 3 of Vixie cron ...
0
votes
1answer
22 views

How can I open a shell in the environment that cron (alternatively launchd) uses to execute commands?

I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to ...
0
votes
1answer
48 views

Does this script run a program once as close as to every 15 seconds and not run two instances at the same time?

In https://unix.stackexchange.com/a/11105/674, Gilles wrote The following crontab line will start some_job every 15 seconds. * * * * * for i in 0 1 2; do some_job & sleep 15; done; some_job ...
0
votes
1answer
21 views

How to ensure keyboard backlight is always on (at max) at boot time?

Question How to ensure keyboard backlight is on (at max) at boot time on a Dell laptop? Rationale I sometimes hit the combination of keys which turns off the keyboard backlight at day time not ...
1
vote
2answers
343 views

Whose PATH value is the default PATH value in a crontab file? [duplicate]

root's default PATH is $ sudo su # echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games After creating /etc/cron.d/myjob 35 * * * * tim ( date &&...
1
vote
1answer
30 views

why do I get the monitoring information from curl in some case and not in other case?

When I run the following command in an interactive bash shell: $ curl ipinfo.io/ip 123.45.67.890 If I create /etc/cron.d/myjob: 24 * * * * tim ( date && curl ipinfo.io/ip && date ) &...
1
vote
1answer
28 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 ...
0
votes
1answer
64 views

Why is my cron job not scheduled?

I am trying to set up a cron job, by creating a file /etc/cron.d/myjob: 55 * * * * t echo hello > /tmp/cron.log && cd /tmp/test/ && pwd > /tmp/cron.log I tried to verify if ...
9
votes
2answers
1k views

Schedule the last day of every month

I read from an instruction to schedule a script on the last day of the month: Note: The astute reader might be wondering just how you would be able to set a command to execute on the last day of ...
0
votes
1answer
23 views

Running multiple screen commands with crontab and log them seperately, giving each a seperate screen name

How can I log the output of multiple screen sessions which are executed by crontab seperately? Currently I am running them in "screen -dm -L " style in crontab but it logs all the sessions to ...
-1
votes
0answers
20 views

will cron.hourly prevent an ubuntu pc from sleeping if the suspend setting is for 1 hour [closed]

I have set my suspend when inactive for to 1 hour. It seems to me that because cron.hourly runs every hour, the pc will never go into suspend mode. Is this correct?
1
vote
0answers
42 views

Debian : E: Command line option --allow-releaseinfo-change is not understood

Since several days i'm getting the following error on a Debian 8 system from cron: /etc/cron.daily/distupgrade: E: Command line option --allow-releaseinfo-change is not understood I never touched ...
2
votes
1answer
34 views

Possibility to disable or hide CRON notification about starting one specific process

Good evening, my question is as the title states. I was wondering if it is possible to having multiple cron jobs in crontab active, but only one of them starts each minute. The problem here is I wish ...
0
votes
0answers
12 views

Is there a command to update all Drupal 8 sites under, for example, /var/www/html?

On my LAMP (Ubuntu 18.04) server environment I've installed Composer globally via: curl -sS https://getcomposer.org/installer -o composer-setup.php php composer-setup.php --install-dir=/usr/local/bin ...
0
votes
1answer
20 views

get an error typeset: not found when i launch my script by crontab?

I use this portion of code to set default values in my config on my script.sh # Copyright (c) 2015 # Licence MIT ( http://choosealicense.com/licenses/mit/ ). #!/bin/sh typeset -A config # init ...
1
vote
1answer
38 views

Running Script via Crontab With Different Result?

I have the following script: #!/bin/bash /usr/bin/echo q | /usr/bin/htop -C | /usr/bin/aha --line-fix | /usr/bin/html2text -width 999 | /usr/bin/grep -v "F1Help\|xml version=" > htop.txt It just ...
-1
votes
1answer
31 views

sct (setcolortemperature) segfaults with cron

Debian stretch user here. I wanted a screen flash every ten minutes. After trying a couple of alternatives (includeing xrefresh) I decided to use sct. It works in shell but does not work with cron. ...
0
votes
1answer
52 views

In what cases will anacron not run?

I am trying to understand how anacron works (in Fedora). I have three related questions. I am confused because of the following statement from the anacrontab manual: The START_HOURS_RANGE variable ...
0
votes
0answers
30 views

For rotating logs- Cronjob issue

Invoking logrotate every 15 mins. logrotate will rotate only after size threshold crosses 1M Working machine [root@machine1 output]# ls -l --block-size=1K total 296 -rw------- 1 root root 55 Oct ...
0
votes
1answer
32 views

How to logrotate 1 MB file?

To rotate logs after the size grows to 1M, cronjob invokes logrotate every 15 mins, as shown below: 0,15,30,45 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf where ...
1
vote
1answer
33 views

Cron job won't run (pgrep issue)

I'm running a cron job every minute, which launches a bash shell script: # Automatically reboot the server if it goes down * * * * * /root/auto-restart.sh I can manually run the script, but whenever ...
0
votes
1answer
104 views

find: failed to restore initial working directory: Permission denied

I am trying to find some files on a path /local/java_apps/ and then delete them using a shell script and generate a log file in the /home/jboss The code is as follows : STAMP=$(date +"%m%d%Y%H%M%S") ...
0
votes
0answers
51 views

Logrotate syslog-NG logging - RHEL 7.x

/usr/sbin/logrotate is used to log rotate syslog-NG logging, as shown below: [root@machine1 output]# crontab -l # 00 23 * * * /TSM/bkup 1>/dev/null 2>&1 1 * * * * /usr/sbin/logrotate /app/...
1
vote
1answer
28 views

Using Cron to restart a systemd user service

I have created a --user service in systemd such that a non privileged user can manage a service. This works well. I wanted to restart the service at a fixed given time of day, so i created a cron job ...
0
votes
0answers
49 views

How to get linux shell script command containing quote working in crontab?

I see an Issue, where shell script command/script works fine when ran through command line or shell script but fails when triggered through crontab. Following are details of the command Command run ...
0
votes
0answers
74 views

Delete a file older than 30 days using a CRON job

I am using a shell script to delete all the pdf files older than 30 days in the path /local/java_apps/ which has 3 more folders. Two of them has a different owner suppose user1 and one folder has the ...