You are not logged in.

#1 2012-03-10 19:51:41

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,730
Website

rsync script [SOLVED]

Hi guys,

I have a little problem that is possible someone knows the answer to smile
I used to back up my system with a GUI program, but lately it began to give me grief so I decided to go the "old Unix way" and started using rsync.

The program works well (and FAST!!) and I'm most happy with the results but this is my problem:
I like to have a popup tell me that the backups are running. I have used in the past, with success I may add, kdialog to do just that.

Now with my new script and rsync it's not working. sad

To be clear... the backups happen on time and as they should but I get no message from kdialog to let me know.

The back up script runs from crontab.

Here is the script:

#!/bin/bash

SOURCE=$HOME/HTML
TARGET=$HOME/.net-backup/spitfire
LOGS=$HOME/bin/backup.d/Logs
EXCLUDE=$HOME/bin/backup.d

# backup report
function show_report {
    /usr/bin/kdialog --title "Backup Notification" --passivepopup "Running 2 hours backup" 10
}

# show on screen
show_report

rsync -azv --delete --exclude-from $EXCLUDE/'exclude.txt' $SOURCE/ceb/ $TARGET/EOHour/ceb/ > $LOGS/ceb.log
rsync -azv --delete --exclude-from $EXCLUDE/'exclude.txt' $SOURCE/SMART2012/ $TARGET/EOHour/SMART2012/ > $LOGS/smart2012.log

Here is the crontab line that runs it:

0 */2 * * * /home/ralvez/bin/backup.d/2hours

Am I missing something? 

Thanks for any advice.

Ricardo

edit: If I run the script "by hand" not with crontab I get the kdialog message

Last edited by ralvez (2012-03-11 02:23:20)

Offline

#2 2012-03-10 19:56:02

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rsync script [SOLVED]

Have you looked in the logs?
Do you run is as root or are you using your user's crontab? Running X apps as root is bad & tricky https://wiki.archlinux.org/index.php/Ru … ps_as_root
https://bbs.archlinux.org/viewtopic.php … 9#p1035169


Please use [ code ] tags for posting snippets of code.

like this

Last edited by karol (2012-03-10 19:58:12)

Offline

#3 2012-03-10 20:18:51

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,730
Website

Re: rsync script [SOLVED]

I'm using it as a user.
I did look at /var/log/everything.log and /var/log/error.log but cannot find anything useful sad

BTW I did use code tags but the wrong way: "<code>" as opposed to "["code"]" tongue

I'll take a look at those links.

R.

Offline

#4 2012-03-10 20:34:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: rsync script [SOLVED]

I've not tried to run something in X from a cron job, but you could try specifying the display for kdialogue to run on.

# edit: this works for me with notify-send

DISPLAY=:0.0 /usr/bin/notify-send Cronjob "Success!"

Last edited by jasonwryan (2012-03-10 20:48:28)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2012-03-11 02:22:52

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,730
Website

Re: rsync script [SOLVED]

@jasonwryan,

You are the man!!
Yes... adding the "DISPLAY=:0.0" did it!!

Thank you all for the help.

R.

Offline

Board footer

Powered by FluxBB