-1
votes
0answers
17 views

Help needed for bash script creation for a cron job [on hold]

I've got to make a bash script for a cron job that should do the following: Try to access a few websites every hour of the day at the minute that is the website's domain length (in example for ...
0
votes
1answer
52 views

Can continually assigning a variable in a shell script cause a memory leak?

I've written a short script to copy Apache's server status to a log: #Save date and time to a variable dt=$(date) #Echo date and time to the log file as it's not included in server-status echo "Time ...
7
votes
7answers
903 views

cron Vs. sleep - which is the better one in terms of efficient cpu/memory utilization?

The Case: I need to run some commands/script at certain intervals of time and for this I have two options - 1. set up a cron-job or, 2. implement a loop with sleep in the script itself. Question: ...
0
votes
2answers
73 views

Cron job is not working [closed]

i have a cron job center code hereonfigured at var/spool/cron/testuser, Am calling "adindex.sh" file from there. Am getting results when am directly put the command directly in prompt(php and sh), ...
2
votes
1answer
267 views

“stdin: is not a tty” mails for running scripts as cron jobs

I have several shell scripts (bash) which are started by cron. Every time a script is executed I get an email saying "stdin: is not a tty". Can someone please tell me how to fix this? All scripts run ...
3
votes
4answers
200 views

Does cron jobs per se represent a significant burden on a modern system?

I'd like to run a pretty simple script (is there a dir with name x in dir y if so move it to dir z–and x will only be there about once a day) every 15 seconds or so (one minute divided into 4*15 ...
2
votes
1answer
109 views

Cronjob output to log

I'm using a script for testing broadband speed and I would like to set up a cronjob for testing every n minutes and output to a file. The command to launch it from a shell console and append to ...
4
votes
2answers
208 views

Cron to not run on specific day but all other days

I have a cron setup to execute a bash script daily at 10pm. I have another cron setup to run monthly on the 1st of the month. Both crons launch a bash script, and the only different in the bash script ...
1
vote
1answer
103 views

Script to restart the application

I need to write a script for the below scenario in Linux: Run a cron every 5 minutes. grep the application log file to see if we can see the pattern "ORA-". If we see this pattern: stop the ...
1
vote
0answers
26 views

Script executed from cron doesn't display GUI notifications [duplicate]

The script below has the name notifyrssh.sh. 1: File=/home/vaios/Desktop/tempcron/liveusers.txt //OK 2: cd /home/vaios/Desktop/tempcron 3: ps -aux | grep sshd > ...
3
votes
2answers
96 views

Cron job for every minute executing out of order?

I'm setting up some shell scripting to be executed every five minutes, then every minute on our client's system, to poll a log and pull some timing information to be stored and accessed by another ...
1
vote
1answer
105 views

Why do I get different outputs when running my shellscript manually from when I run it with cron? [duplicate]

I have a fairly simple shell script (foo.sh) that looks like this: #!/bin/bash echo -n "$USER,$(date)," `binary -flags | sed -e '1,30d'`; exit 0; This script is supposed to prepare some output ...
3
votes
1answer
204 views

ls gives me different sort orders during a cron job

I have a cron job that, among other things, does a recursive ls of a directory into a file. This gets compared to another file that I've created that, supposedly, contains an identical listing of the ...
2
votes
1answer
202 views

bash script - supervisor program

I have to write a shell-script that have to do the following tasks: -in every 5 seconds it saves:     -how many users are using joe and/or vi;     -if ...
0
votes
2answers
745 views

Xdotool using “DISPLAY=:0” not works in Crontab

I need to run shell script contains Xdotool codes in /home/z/Desktop/tempo/run.sh. I've tried many ways of DISPLAY=:0 but always not works. I've tried each of below codes, and not works: * * * * * ...
0
votes
1answer
146 views

top not working

My below cronjob is not working. What am I doing wrong here?? */5 * * * * /usr/bin/top -n1 | head -10 >>/tmp/load.txt
2
votes
1answer
846 views

Users home path in a bash script

I'm writing a bash-script that will be run as a cron job everyday. Very basic, I was wanting to change the wallpaper daily. I have mint-14 with mate. The thing I'm getting caught up on right now ...
-1
votes
3answers
832 views

How to run a shell script with export command in crontab

I have a shell script that exports values of variables when executed. The same values will be used in another script. How to run this script(test.sh) in cron. #!/bin/sh export I="10" echo $I I will ...
3
votes
2answers
1k views

Bash script doesn't work as cronjob

I'm trying to get this simple bash script to work within a cronjob. It's used to generate static nginx webserver statistic pages using GoAccess. I tried everything I know to resolve this issue, it ...
8
votes
1answer
835 views

Suppress output unless non-zero exit code

What's the best way to suppress output (stdout and stderr) unless the program exits with a non-zero code? I'm thinking: quiet_success() { file=/tmp/suppressed if ! ( "$@" > "$file" ...
1
vote
1answer
966 views

Trying to create a cron to Rsync then tar the folder

I'm stuck at the first hurdle! I want to run a couple of commands from a bash script. First something like this to rsync some directories: rsync -e ssh -az user-whatever@website.com:/home ...
3
votes
4answers
528 views

command for counting number of active cron jobs in crontabs

Problem statement I have 5 solaris boxes, some have Solaris 10 and some have Solaris 9. All of them have many cronjobs in their crontabs. I would like to know number of active cronjobs available, so ...
5
votes
1answer
1k views

Running cron script with lynx fails to work

I'm trying to automate a login process that can only be done through a browser. I am using the lynx browser to script the actions required to do this. Lynx does this by dumping a user's keystrokes ...
2
votes
4answers
511 views

Is there any handy command line tool to manage Cron jobs?

Would someone suggest any handy command line (NOT web) tool or script which adds, enables and disables Cron jobs? I am looking, for example, for the following (or similar) behavior: sh manageCron.sh ...
1
vote
2answers
1k views

Using rsync in a cronjob when a password is needed

Basically I have a bash script that fetches data from my server to perform a backup. As it is now I have to start that script manually, enter the password, and then wait for it to finish. I would ...
26
votes
9answers
11k views

Correct locking in shell scripts?

Sometimes you have to make sure that only one instance of a shell script is running at the same time. For example a cron job which is executed via crond that does not provide locking on its own (e.g. ...
9
votes
2answers
979 views

How can I delete all files in a folder that haven't been accessed in a certain amount of time?

I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
3
votes
2answers
2k views

Add a one-off scheduled task through a shell script?

I'd like to execute a task at a given time, once. I know I can just use crontab -e to add it there, but I'd like to do that through a shellscript. crontab -e gives me some temporary file to edit ...