Tagged Questions
9
votes
5answers
5k views
Run a script via cron every other week
I've done quite a bit of research in how to do this, and I see there's no direct way in cron to run a job, say, every other Thursday.
Right now, I'm leaning toward making a script that will just run ...
5
votes
4answers
2k views
Check if script is started by cron, rather than invoked manually
Is there any variable that cron set when it's running a program ? If the script is running by cron, I'll skip some parts; otherwise invoke those parts.
How can I know if the bash script is started by ...
5
votes
3answers
1k views
Using notify-send with cron
I am using Arch Linux with KDE/Awesome WM. I am trying to get notify-send to work with cron. I have tried setting DISPLAY/XAUTHORITY variables, and running notify-send with "sudo -u", all without ...
4
votes
3answers
1k views
In linux, would it be possible to run a script every day 3 minutes later than the previous day?
My first solution to this was to execute date +%Y%m%d%H%M and put that format of numbers into a file, and run the script every minute from cron. Then if the date from the file matches the date ...
3
votes
2answers
140 views
Does cron know that the instance to be scheduled is already running?
I was wondering if we add a job in the crontab e.g. to run every 5 mins and the job does not actually manage to finish in 5 mins, does the cron daemon know that the previous instance is already ...
2
votes
1answer
374 views
Script to check a folder, print the files then delete those files
I am looking for some guidance on creating a script that will check a specific folder, print all documents (if any) and then delete those documents. I would also like to run this script as a cron job. ...
2
votes
4answers
1k views
Anacron job complains “Gtk-WARNING **: cannot open display”
I'm trying to make a simple weekly Anacron job that backs up my computer if I click yes on the dialog. The script I wrote works fine if run manually, but when Anacron runs it, nothing happens and I ...
1
vote
1answer
111 views
Cron task in graphic interface
I need to open one (or more) browser tab periodically and I decided to use cron.
The command in the shell (bash) that correctly executes this task is chromium-browser http://mysite.com. If I type it, ...
1
vote
2answers
2k views
how do I run a cron job with a specific user?
My cron and scripting skills are very poor, but I need to run a job every 5 minutes by user 'cpc'. So I created a script and left it at /root.
My crontab -e entry about it is:
0-59/5 * * * * ...
1
vote
1answer
147 views
Shell script and crontab to capture file size, name and date in a CSV file and then send via email?
I have a number of zip files in a certain folder. I want to capture file name and the size of the files in a CSV format in day wise and put it in crontab so I can report on a daily basis, and then ...
1
vote
0answers
534 views
Cron file syntax checker/validator script
Does anyone know a script (bash, perl, php ...) to validate the syntax of crontab files?
I found this http://www.intuitive.com/wicked/showscript.cgi?053-verifycron.sh but just Vixie cron notation is ...
0
votes
2answers
539 views
Run a script at startup
I am using Ubuntu 14.04. I wrote a small script named trial. The contents of the script are as follows:
#!/bin/sh
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
sh -c firefox
I copied the ...
0
votes
1answer
601 views
grep searchstring /etc/crontab strange behavior in BASH script
I am working on a BASH script which creates automated backups via the crontab. I am trying to use
myVARIABLE=`grep backup /etc/crontab`
to return lines containing "backup" if an entry has already ...
0
votes
2answers
31 views
Write log for a false statement of an if condition which returns exit 2
I have a script running every 5 mins with two exits in a condition clause.
#!/bin/bash
date=$(date +%Y)
if [ $date -eq '2014' ]
then
echo "Current year is $date"
exit 0
else
echo "Current ...
0
votes
2answers
1k views
Ubuntu crontab php not working
Yes, I have read many, many documentations but I can't get it to work. I have a simple single php file which I want to run once or twice in a minute. My php file is called: cronjob_refresh.php and I'm ...
0
votes
1answer
194 views
ipset not executing from crontab
I have this txt files that contains IPs, one per line of file, that I want to block using ipset.
I have this bash script that essentially reads from the plain txt file and constructs an array. Then ...
0
votes
2answers
290 views
Why does this fail as crontab but works as script [duplicate]
Possible Duplicate:
What’s wrong with these two cron job’s?
I want to print a formatted output from a file containing lines of date, time, long number, and long number. I set LC_NUMERIC to ...
-1
votes
2answers
179 views
Shell script passing null value while executed as cron job [closed]
We are using the below commands to get pagesapce values and I need to check percent of used pagespace. For this I have used the below code, but when running this script it's passing a null value into ...