-2
votes
1answer
29 views

Bash and cron error [duplicate]

The following cron job fails to execute. What's wrong with it? It works fine when I run it directly from the shell prompt. www-data@etl:~$ crontab -l SHELL=/bin/bash MAITO="" 0 5 * * * export ...
1
vote
2answers
143 views

Linux Bash IF conditions not processing when running as crontab

So I've made myself a little script which monitors my served directories for any PHP files which have changed. It's designed to run every 5 mins from crontab and email me any changes so that I can ...
1
vote
1answer
45 views

Script won't do what it should when run with cron

I've got some problem. I have script execution scheduled but when time comes nothing happens. #!/bin/sh TIME=`date +"%d-%m-%Y"` cd /var/www/flyer/data/www/ mysqldump -u root -ppasswd --databases ...
0
votes
1answer
52 views

Unable to get cron to append output from wget

I have a cronjob setup and running, but the logfile keeps getting overwritten every time it runs. I would like for the wget output to be appended each time the cron runs. Why is this and how do I fix ...
0
votes
0answers
33 views

Include executed cron command when outputting to log

Is there a way I can include the command in the output when I'm logging to a file? For example * * * * * date && /path/to/php /path/to/script.php >> cron.log 2>&1 Would give ...
0
votes
1answer
161 views

cron.hourly script executing multiple times

The setup I have a script /etc/cron.hourly/msm-hourly that contains this: #!/bin/sh LOGPATH='/opt/msm/servers/cronscripts' LOGFILE="$LOGPATH/msm-start.log" # Make restart dead servers echo "" ...
0
votes
3answers
103 views

script bash can't get difference in $PS1 or $- when running interactivelly or via cron

I want my cron scripts being executed verbosly when run interactively by a system user (for debug purpose for instance) and quietly otherwise (for cron, as I want receive e-mail if and only if I get ...
2
votes
2answers
166 views

check if process is running, even under cron

I have a cron job that runs every minute, but if it finds data, might take many minutes to finish. I need to tell if another instance of the script is running from another. To make things even more ...
1
vote
1answer
89 views

Script doesn't work as cron job [closed]

I have a script that I wrote to verify on an OS X machine (v 10.7.4) if a volume is up or down. If it goes down, it is supposed to send an email. When I run the script from the command line, it works ...
1
vote
1answer
52 views

Cronjobs putting archive in wrong directory

I am running a website on an Amazon ec2 instance running the default Debian linux. I set up a cronjob to copy the site files, take a database imprint, and zip them up. I want to keep the file ...
1
vote
2answers
450 views

how to execute bash script with crontab in centos? [duplicate]

My bash file is not executed by cronjob created as root. The cronjob setup looks as it follows 0 0 * * * mysql_backup.sh does need to be decalared with the bash command 0 0 * * * bash ...
0
votes
1answer
232 views

Review of a crontab script to add timestamps to minutely runs; any suggestions?

I've got a crontab job set to run minutely as such: * * * * * /home/username/public_html/domain.tld/production/scripts/cron_runner.sh My goal is to add some timestamps to output from cron so I can ...
15
votes
2answers
489 views

Is there a utility like cron, that schedules a job for later (but only once)?

I'm trying to design a program that sends a text when a certain (non-periodic) event occurs. Right now, I'd like a script that finds when this event occurs, and then schedules a (cron-like) job that ...
0
votes
3answers
800 views

Cant run rc.local manually and doesn't run automatically on ubuntu

This is quite a simple one. I created an rc.local file here: /etc/rc.local I made it executable. However, it doesn't run when I boot the server. I can see it in the directory and when I try to run ...
2
votes
2answers
191 views

Why doesn't this command work as a cronjob, while it works perfectly when typed in a shell?

If I run this command from the shell, it works as expected: cd ~ && mysqldump --databases --skip-dump-date --host=localhost --user=admin --password=xxxxx --lock-all-tables ...
1
vote
2answers
428 views

shell script in crontab, not all output being logged

I've got a simple shell script that runs a few LFTP commands and processes the files. When running straight from bash I get full output of those LFTP commands on screen. When running from crontab ...
0
votes
2answers
187 views

glassfish start script fails through crontab

I have a created a script to check to see if my glassfish server is running, if it isn't, it attempts to kill the java process to ensure it's not hung, and then issues the asadmin start-domain command ...
1
vote
1answer
90 views

apt-get upgrade will run on command line but not from cron bash script

Running the following commands on the command line works fine $sudo apt-get update $sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state ...
0
votes
2answers
36 views

Redirect output to subfolders that don't yet exist

I currently redirect crontab script output to file in some folder that exists, like this: echo "test" > `date "+/tmp/%Y%m%d_%H%M.log"` I want to redirect output to subfolders, that maybe don't ...
0
votes
3answers
78 views

Can't figure what's wrong with with my crontab

Due to some bug in one of my scripts i'm being forced to delete temp files every 30 minutes until i'll figure it out and debug it. To get it done i've written a small bash script that i run every 30 ...
1
vote
1answer
446 views

cron does not follow bash script's instruction to send mail conditionally

I am having trouble getting cron to email an attachment based on a predefined condition set in the bash script. The following is my /etc/crontab setting: SHELL=/bin/bash ...
0
votes
6answers
1k views

Bash script runs manually, but fails on crontab

I'm a newbie to shell scripting. I have written a shell script to do incremental backup of MySQL database.The script is in executable format and runs successfully when executed manually but fails when ...
2
votes
1answer
514 views

AWS API Tools “Command Not Found” When Executing from Cron

I have created this bash script to generate a snapshot of my EBS Volume #! /usr/bin/bash ec2-create-snapshot -d "My Snapshot" vol-XXXXXXX -O <MyKey> -W <MyOtherKey> And it works when I ...
-1
votes
1answer
625 views

cron job not running on Centos 6.3

I have created a cron job that runs a script which moves files from one location to another. Here is my result after running crontab -l 0 6 * * 0 root /root/scripts/move.script.sh ...
0
votes
1answer
139 views

Crontab start a screen

I started a screen by shell script in crontab, when I entered the screen, the left side became "sh-4.1#". While I runed the script directly, it was nomal with "[root@localhost data]". What happened? ...
-2
votes
2answers
61 views

cron job allowed commands

i can use this command in cron job cat /etc/passwd its send my an email about all users info how i can see allowed command? like cat ! can i use service httpd restart? ( i test it and i cant) ...
-1
votes
2answers
163 views

copy cron job from one domain to another on same server

I have just set up the .com of a domain that previous ran on .co.uk on the same server, I have copied all the files, ran through them using bash to change the domain anywhere it was referenced, same ...
0
votes
1answer
205 views

Evaluate cron expression

Is there a command line tool that will simply evaluate a cron expression and return a bool response if it is supposed to be running right now? I'm looking for something I can use as a utility in ...
0
votes
3answers
2k views

Command does not execute in crontab while command itself works just fine

I have this script from Colin Johnson on Github - https://github.com/colinbjohnson/aws-missing-tools/tree/master/ec2-automate-backup It seems great. I have modified it to send email to myself every ...
0
votes
2answers
243 views

Bash script getting automatically deleted from Ubuntu 12.04 Server?

I'm running a bash script on an ubuntu 12.04 through cron. The script works fine for a few weeks (runs daily backups of websites, mysql databases, and copies to Amazon S3). However, twice now I've ...
0
votes
4answers
138 views

Assigning environment variables for CRON

I have a .sh script that creates a .tar.gz file and transfer's it to a remote server using RSA keys for authentication. The script will run from terminal but it will not when I try to set it up as a ...
0
votes
2answers
244 views

How can I create a bash script for MySQL status/replication that only notifies of failure once per hour?

I am using CentOS 6.2. I followed Alex Williams guide to configuring MySQL through HAProxy found here. Instead of having HAProxy check the status of MySQL and replication, I have the scripts running ...
1
vote
3answers
451 views

Make cron log rsync only if there was transfer

I have this crontab running every 5 minutes: date >> ~/18/rsync.log rsync -vaz user@r18:~/assets ~/18 >> ~/18/rsync.log 2>&1 It adds this to the log file every 5 minutes: Thu ...
0
votes
1answer
262 views

Cron task failing on specific job

On my server I am getting the following error when running one of my cron tasks: CRON[9913]: (CRON) error (grandchild #9915 failed with exit status 127) The server is running ...
3
votes
2answers
729 views

Why does cron.weekly not run?

When I noticed that the backupscript I placed in /etc/cron.weekly on my Debian6 server isn't executed I placed this small script in it, to see if the weekly cronjob is executed at all: #!/bin/bash ...
2
votes
1answer
166 views

Using cron and a script, how can I get something to be triggered, for example, at 10am, 11 days before the last Tuesday of every month?

I'd like to schedule a task to be run a number of seconds, minutes, hours, days or weeks before a specified day of a week in a particular month. Examples would be: at 8am, 7 days before the last ...
1
vote
2answers
591 views

copy cron jobs from one server to another server - using bash prefereable

I have recently done a migration from on dedicated centos server to another dedicated centos server. There were few backup cron jobs was runing on my old server. I would like to copy them to new ...
1
vote
1answer
79 views

Linux execute permissions

-rw-r--r--. 1 myusername developers 169 May 17 09:01 build.sh Why is it I can execute the build.sh script from the command line if it does not have execute permissions but when crontab tries to ...
1
vote
1answer
92 views

cpanel cronjob curl increase file size

I created a bash script to run as a cronjob with Cpanel: --------------content of cron.sh--------------------- #!/bin/bash curl http://website.com/1.gif >> ...
1
vote
2answers
375 views

script to remove all files in /tmp from a certain user

One of my server daemons uses a lot of space in /tmp. Because I don't want to reboot my machine when the server runs out of disk space, I need to run a CRON script that removes old temporary files. ...
1
vote
1answer
311 views

Shutdown script

I am using Ubuntu 11.10. I would like to make a shell script that shut down computer if nobody logins for an hour. But if somebody logins (locally or with remote SSH connection), then i don't want ...
1
vote
2answers
337 views

What's the advantage of using a bash script for cron jobs?

From my understanding you can write your crons by editing crontab -e I've found several sources that instead refer to a bash script in the cron job, rather than writing a job line for line. Is the ...
1
vote
2answers
794 views

Cron not running commands as root

I have a file called /scripts/checkInternet and it contains: #!/bin/bash WGET="/usr/bin/wget" rm /tmp/index.google $WGET -q --tries=10 --timeout=5 http://www.google.com -O ...
0
votes
2answers
324 views

BASH store values in an array and check difference of each value

[CentOS, BASH, cron] Is there a method to declare variants that would keep even when system restarts? The scenario is to snmpwalk interface I/O errors and store the values in an array. A cron job to ...
2
votes
3answers
1k views

Run bash_profile in cron job

I had a problem that my cron script wasnt loading the environment variables so I added the following line: #!/bin/sh bash /root/.bash_profile This seems to have no effect and the path variables are ...
3
votes
4answers
949 views

Bash script is not working as cron job

I have the following shell script $cat capture.sh TIME=$(date +"%H-%M-%d-%m-%y") IP="203.208.198.29" PREFIX=$TIME$IP tshark -f "udp" -i eth0 -w /root/captures/$PREFIX.cap& pid=$! sleep 2m ...
2
votes
2answers
2k views

Sending mail from command line if body not empty

I'd like to write a simple script that alerts me if a log changes. For this I'm using grep to find the lines I'm interested in. Right now it works like this: grep line /var/log/file | mail -s Log ...
0
votes
1answer
132 views

How to run the cron job as a user instead of root user

I have few bash scripts which are adding to cron jobs with specified timing, but it needs to be executed as root user. I am trying to run those scripts i.e., crob jobs but it needs root user ...
6
votes
2answers
1k views

My cron tasks report command not found

This is the contents of my crontab file: 0 0,6,12,18 * * * cd /var/www/app/current && backup perform --trigger db_backup --config_file config/backup.rb --data-path db --log-path log ...
2
votes
1answer
652 views

How do I stop script after certain maximum time?

I am doing daily backups to S3. I would only like to consume upload bandwidth only from 8 PM - 8 AM. Any individual run could take longer than 12 hours because our upload is crappy. I'm not worried ...