0
votes
1answer
31 views

Can't run AWS CLI from CRON (credentials)

Trying to run a simple AWS CLI backup script. It loops through lines in an include file, backs those paths up to S3, and dumps output to a log file. When I run this command directly, it runs without ...
0
votes
1answer
33 views

Binding timestamp value to a variable in crontab

I'm basically trying to declare a variable with a date() value in crontab as I will constantly be using the same date structure over and over, here is what my crontab looks like so far. php = ...
0
votes
2answers
60 views

Backup Ubuntu server with cron/rsync: Problems with resuming large files

I currently have a dedicated Ubuntu backup server which wakes itself up from suspend (using rtcwake) daily. 5 minutes later a cron BASH job kicks in, using rsync to pull files from various network ...
0
votes
1answer
86 views

ways to automatically fix line endings in shell scripts or files who break with ^M

Problem We regularly break our files lines endings and things stop working without us noticing. Bash complains about "invalid option" or ": command not found" as described here: ...
0
votes
0answers
28 views

Bash Script issue : Discrepancy in output when executed via cron [duplicate]

I have written a bash script that writes date and database size of a DB to a text file. The script is executed via cron every week. There is some discrepancy in the output that is being generated . I ...
0
votes
1answer
71 views

Shell script only executes partially when run with CRON [duplicate]

I've written a shell script that does the following: Retrieve mail from a POP3 account (using GetMail) Save a copy of that email to S3 (using AWS CLI) Email me the filesize of the email The ...
1
vote
1answer
46 views

Difference between “crontab -e” & editing crontab file manually? [duplicate]

I noticed some people use "crontab -l" to view cronjobs and "crontab -e" to edit them. However there are also times where people manually modify "/etc/crontab" to view/add/remove cronjobs. Both ...
1
vote
1answer
61 views

Programmatically adding two lines to crontab

I'm trying to add two lines to the root crontab when building an AWS instance. I have a set of commands that are part of the "user data". These commands are run as root when creating the instance. I ...
-2
votes
1answer
69 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
280 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
52 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
80 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
37 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
233 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
109 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
219 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
99 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
53 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
826 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
250 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
496 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
1k 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
211 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
484 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
242 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
113 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
40 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
82 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
479 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
2k 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
784 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
933 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
148 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
62 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
196 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
235 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
3k 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
251 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
145 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
260 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
4answers
528 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
276 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
818 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
171 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
750 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
96 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
428 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
335 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
367 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 ...