Ubuntu :: Rsync - .sh And Crontab
Feb 14, 2011
I'm currently trying to have crontab to automatically backup files from ramdisk. It works perfectly when I run it myself by simply cd:ing to scripts directory and type ./save_world.sh.
The problem is, that crontab DOES (at least it looks like it) run that command every one minute. /var/log/syslog does show it executing that line every one minute without any errors. I'm currently very confused what I did wrong here. I have tried rebooting, fiddling with crontab line, tried sudo crontab -e but nothing seems to work.
My script is called save_world.sh and it is located in /home/phoe/minecraft/rpg/
Code:
My crontab -e has one line and it is following:
Code:
I haven't determined any specific time yet, because I'm just trying to get it work first.
Snippet from /var/log/syslog:
Code:
View 4 Replies
ADVERTISEMENT
Apr 12, 2011
I have a tiny shell script to rsync files between two servers and remove the source files.
This script works fine, when it has been initiated manually or even when the rsync command is executed on the command line.
But the same script doesn't work, when I try to automate it through crontab.
I am using 'abc' user to execute this rsync, instead of root, as root login to servers are restricted in all of our servers, by us.
As I mentioned earlier, manual execution works like charm!
When this rsync.sh is initiated through crontab, it runs the first command(chown abc.abc ...) perfectly without any issues. But the second line is not at all executed, and there is no log entry i can find at /mnt/xyz/folder/rsync.log.
View 6 Replies
View Related
Apr 11, 2011
This is a quick one, I don't have any problems yet, I just want to check that this is going to do what I think it is. I added the line
Code:
00 01 * * * rsync -avz --delete /local-storage /mnt/usbackup
to my crontab file, am I to understand that this will backup /local-storage to my external
[code]...
View 4 Replies
View Related
Apr 27, 2010
I am using Linux 64 bit Redhat Linux. I am trying to setup simple crontab as follow...1. Edited crontab file using crontab -e2. Listed the file once to verify it using crontab -l. This will display as.. 18 5 * * 2-3 ksh $HOME/testScript.sh > $HOME/testscript.out3. Logged in a root and restarted cron deamon using "/etc/init.d/crond restart"As per my understanding now my testScript should start running at 5:18 am Thuesday
View 3 Replies
View Related
Jun 23, 2011
is it possible disabling a crontab job without deleting the crontab description entry (by crontab -e)?I could also accept to change the entry itself. Now it's:0 0 * * 0-6 /home/me/cron/script.csh
View 4 Replies
View Related
Aug 26, 2010
I have a question about using crontab with /etc/crontab...
I had a cron job that I needed to run as root. At the time I thought that sticking it in /etc/crontab would be a good idea. However, I used the crontab command to edit /etc/crontab, which I guess is not standard procedure? Specifically, I configured /etc/crontab as my local user's crontab (i.e. sudo crontab /etc/crontab) then added my cron job as I would a local user crontab (i.e. sudo crontab -e).
Originally, my cron job looked like this:
30 * * * * root /my/batch/script &> /dev/null
After adding the new cron job I started seeing errors. Something to the effect of "can't find command root" or something similar. So I removed the 'root' user definition from the cron job and the job started running fine. However, because this is /etc/crontab, there are other system related cron jobs that have been defined to run under the root account (e.g. "17 * * * * root cd / && run-parts --report /etc/cron.hourly" runs as root, etc.). So these pre-existing system cron jobs, which up until now have been running smoothly, are now generating "can't find command root" errors. But I think that the system cron jobs _are_ successfully being run someplace because logrotate seems to be working.
So what I _think_ is happening is that /etc/crontab is being run twice: once as the system crontab, and once as my sudoed local user's crontab. When I run crontab -l I see nothing, but when I run sudo crontab -l I can see the contents of /etc/crontab. I am reluctant to delete my sudoed local user's crontab, because then in the process I would be deleting the system crontab, and I do not know how I should restore the system crontab's contents. (I am still not sure as to the most appropriate way to edit the system crontab).
How can I get out of this mess? I want /etc/crontab to go back to the way it was before--running _once_ as the system crontab. As for my new cron job, I'm willing to reconfigure it anywhere so long as I am still able to run it as root. Any ideas? (I am using Ubuntu 8.04 Server LTE)
View 2 Replies
View Related
Apr 9, 2011
I have installed an application manager(monitoring application) on my linux server. Now, i need to have backup schedule for my application. The application itself has executive file to backup database.But when i put this file in my crontab to schedule the backup program it wont run!50 09 * * * root /opt/ME/AppManager9/bin/BackupMysqlDB.sh
View 1 Replies
View Related
Nov 17, 2010
Thought I'd post it here because it's more server related than desktop... I have a script that does:
[Code]....
This is used to sync my local development snapshot with the live web server. There has to be a more compact way of doing this? Can I combine some of the rsyncs? Can I make the rsync set or keep the user and group affiliations? Can I exclude .* yet include .htaccess?
View 6 Replies
View Related
Jan 7, 2011
When I run rsync --recursive --times --perms --links --delete --exclude-from='Documents/exclude.txt' ./ /media/myusb/
where Documents/exclude.txt is
- /Downloads/
- /Desktop/books/
the files in those directories are still copied onto my USB.
And...
I used fetchmail to download all my gmail emails. When I run rsync -ar --exclude-from='/home/xtheunknown0/Documents/exclude.txt' ./ /media/myusb/ I get the first image at url.
View 9 Replies
View Related
Sep 18, 2009
I just tried to sync files from one server to another. After the sync process, I found the files are bigger than original ones.
I looked up the web and found someone mentions the rsync daemon. So I have to run the daemon on one server before I run the rsync?
The command I used is rsync --partial --progress -r source destination
View 1 Replies
View Related
Jul 21, 2010
use rsync to cp such files and dirs under /var/www/html/mydir directory but these two files(/dir4/1.html /dir4/2.html) cant rsync to dest mechine.
rsync configure file,below...
View 2 Replies
View Related
Jul 21, 2011
I was trying to write a crontab entry using "crontab -e"
Code:
0 0 * * * cp /var/log/httpd/domains/mydomain.net.log
/home/admin/logs/mydomain.net.log
crontab is giving me this error:
Code:
"/tmp/crontab.XXXXfMOnRS":2: bad minute
errors in crontab file, can't install.
I've tried a dozen different values for the minute, but it's still giving me the same error.
View 5 Replies
View Related
Dec 8, 2010
I'm using Ubuntu 10.04 LTS server and Postgresql 8.4. I have a .sh script that is run by cron every other hour. That works fine. The .sh script includes an rsync command that copies a postgresql dump .tar file to a remote archive location via ssh. That fails when run by cron; I think because it is (quietly) asking for the remote user's password (and not getting it). I set up the public/private ssh key arrangement. The script succeeds when run manually as the same user that the cron job uses, and does not ask for the password. I am able to ssh to the remote server from the source server (using the same username) and not get the password prompt (both directions), so why doesn't rsync work? I even put a .pgpass file in the root of that user's directory with that user's password, and the user/password are identical on both servers.
I think the problem is rsync is not able to use the ssh key correctly. I tried adding this to my script but it didn't help.
Code:
Here is the rsync command embedding in the .sh script.
Code:
Here is the cron entry:
Code:
View 6 Replies
View Related
May 29, 2011
What is the difference between the crontab located in /etc/crontab and the crontab that can be edited using crontab -e?
View 2 Replies
View Related
Sep 1, 2010
How to use crontab? i need to set crontab to execute a file every 1 minute
View 2 Replies
View Related
Jan 10, 2010
Let me first start by introducing myself. I'm completely new to Linux. I've always argued Windows was better, even if I secretly thought not. Anyways the time has come to make the transition (I'm moving into computer forensics so I need to learn linux )
SO i'm trying to use crontab -e. I've installed gnome scheduler as I'm not comfortable editing in command line yet.
I've setup blackjack to start everyday at 23.30. The command line I've entered is /usr/games/blackjack and this works perfectly fine in command line.
View 2 Replies
View Related
Jan 21, 2010
Edit: commands like Firefox works after I set it to display properly. I still can't get personal scripts to run, though.I can't seem to get crontab to run my commands. I add
Code:
* * * * * /home/username/script
but it doesn't seem to work. The script works itself in the shell
View 1 Replies
View Related
Mar 2, 2010
I want to schedule a Java program to run at a certain time, which will open a GUI progress monitor while it runs, and then terminate when it's done. I can execute it fine from the command line, but I it doesn't seem to work when I schedule it with crontab. In fact, I can't make any gui by scheduling it, not even something like gedit or firefox.
I know it's pretty rare that someone would want to do this, but is there any way to schedule a GUI app?
View 1 Replies
View Related
Jun 16, 2010
I'm having problems trying to restart gdm from crontab and I'm not sure what I'm doing wrong. Basically what I want to do is a 'logout' every morning before I get to work so that by the time I get to my computer I would just have to log back in and have a fresh gnome session.
The command I'm using to restart gdm is:
Code:
/usr/sbin/service gdm restart
If I run this command from a terminal as root it works.
To edit my crontab file I'm doing:
Code:
sudo crontab -u root -e
And adding the following line to it:
Code:
25 08 * * 1-5 /usr/sbin/service gdm restart
My understanding is that this should restart gdm every day of the work week (Mon-Fri) at 08:25. But for some reason this is not happening.
I also checked that my cron deamon is running by:
Code:
~$ service gdm status
gdm start/running, process 27156
View 5 Replies
View Related
Aug 4, 2010
I have a .sh file which i want to run using crontab at a specific time with root privilege.
I put an entry in root's crontab as the following:
sh /home/vivek/ifconfig/college.sh
But, the file do not get executed at a given time.
View 1 Replies
View Related
Aug 19, 2010
Figure out why this /etc/crontab won't run correctly?
Is it possible that it don't run because the cron deamon is not running? code...
View 1 Replies
View Related
Sep 1, 2011
I am a xfce user. I have a list of wallpapers and I wanted to change them every 5 minutes Initially I was using a simple command in crontab entry to change it, Quote: */5 * * * * xfdesktop --reload it was working but it would crash xfdesktop process after few changes and the screen would be all grey. To solve this issues I wrote a simple script which would check if xfdesktop is alive and if yes it would call xfdesktop --reload else start xfdesktop I called this script idesktop & its path is ~/.bin/idesktop
[Code]....
View 8 Replies
View Related
Apr 15, 2010
A couple days ago I noticed cron stopped working and now I can't create a new file using crontab -e. When I hit crontab -e I get the editor but after saving nothing comes up under crontab -l and the file is blank when I reopen it. I don't have a cron.allow or a cron.deny.
View 4 Replies
View Related
Apr 20, 2010
Have just started to use look at crontab. I could use Scheduled Tasks as well as crontab -e in terminal.
I must have changed something because now Scheduled Tasks just seems to load then dropout. Loading a task through terminal is accepten (crontab -e) but doesn't work.
View 1 Replies
View Related
May 23, 2010
Pidgin likes to randomly crash on me, and sometimes it takes me awhile to notice. So I thought why not make a script and cron job to see if pidgin is running and restart it if needed. Sounded easy but having all kinds of problems. Here's my cron line...
Code:
*/1 * * * * /home/justin/chkpdgn.sh >> /home/justin/test.log 2>&1
I run "tail -f /home/justin/test.log" to keep an eye on the cron output.
Here's the chkpdgn.sh script...
Code:
#!/bin/bash
SERVICE='pidgin'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, everything is fine"
else
echo "$SERVICE is not running"
$SERVICE
fi
Running that works fine when I do it, but when cron does it pidgin never starts and I get this error...
Code:
pidgin is not running
error: line 15: bad flag alias index: 0
error: line 15: bad flag vector alias
error: line 16: bad flag alias index: 0
error: line 16: bad flag vector alias
That goes on for quite awhile up to like line 60000 and pidgin runs but doesn't show up in the me menu. Any way to restart pidgin when it crashes?
View 2 Replies
View Related
Jun 29, 2010
Not strictly being applied to an Ubuntu distro but Linux all the same.Our company run a database server referenced by a number of mail servers; the database server is very soon to be replaced since it's old, decrepit and not as secure as it should be - indeed, when it decides it's had enough, the MySQL process will simply stop.You can restart MySQL if you need to quite easily; using Putty, I'll connect to the box and run the command:/etc/rc.d/ init.d/mysqld restart
Using /etc/rc.d/init.d/mysqld status you can get a response of either mysqld (pid 8354) is running... or mysqld is stopped - how can I use this information in a script so that mysqld is only restarted if every thirty minutes a check comes back to say it's stopped? this current server is replaced by someone who knows what he's doing in a few weeks but this will ensure less disruption to those who rely on the current incarnation...
View 2 Replies
View Related
Sep 16, 2010
My Problem: The output redirection auf a script works if the script is called in the terminal but not when its called via crontab.
My Situation: I have 2 scripts:
~/backup1
Code:
echo backup a to c
rsync -a -v --progress --delete --exclude=.Trash-1000 /path/a/ /path/c/backup/
echo backup b to c
[Code]...
View 1 Replies
View Related
Nov 12, 2010
I recently set up some new cron jobs under Ubuntu 10.04 64-bit (all the latest patches as of Nov. 11th) and just happened to check right after one was supposed to run and it hadn't run yet. Checking the logs I found the previous cron job ran exactly one hour later than it was supposed to. Is there something going on with Ubuntu 10.04, cron, and daylight savings where cron pretends daylight savings never happened or something?
View 2 Replies
View Related
Dec 8, 2010
Code...
I opened "crontab -e" in the Terminal and in nano I copied and pasted the first line of this copied script, leaving all the notated lines out. Each time I manually run changer by clicking and selecting "Run" it changes my Wallpaper but this does not happen automatically no matter how many times I reboot.
View 3 Replies
View Related
Dec 26, 2010
My ISP specifies a time between 2 - 8 am for free upload /download
I would like to stop deluge using crontab at a specified time. How do i do this?
also even poweroffing the system would do..i tried adding a simple poweroff command in crontab under both user and root but it didnt work?
using xubuntu 10.10 and crontab...also have gnome-scheduler installed
View 3 Replies
View Related