LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Writing a script in LuckyBackup (https://www.linuxquestions.org/questions/linux-newbie-8/writing-a-script-in-luckybackup-922864/)

gtrrockz84 01-09-2012 09:48 AM

Writing a script in LuckyBackup
 
Hi Everyone,
I have luckybackup up and running and all seems good. But i want it to perform a chown and chmod command before it backs things from one drive to another. I installed Kwrite and but have no clue how to write the command in it and connect it to luckybackup. I tried writng the command in kwrite the way you would in terminal, then saved it and went to lucky backup and clicked the advanced button and browsed and opened the file in there. But when i run it it gives me some error command.

Please help me in how to write script/bashing for lucky backup (not sure what bash script is (i found that through googling))

Thanks a ton

unSpawn 01-09-2012 10:33 AM

Did you see the manual example: http://luckybackup.sourceforge.net/m...cedAlsoExecute ?

gtrrockz84 01-10-2012 11:59 AM

Thanks for your response. I did try writing "sudo chmod..." in the line and add it. But when i dry run it, it gives me error. I googled it and some people said that they wrote the commands in kwrite and then linked the file to the lucky backup. They added the file and that somehow automatically ran the code? So i tried that and even that didnt work :(.

unSpawn 01-10-2012 02:29 PM

Create this text as a file using your favorite editor:
Code:

#!/bin/bash --
PROGNAME=${0//*\//};
logger -t "${PROGNAME//.*/}" "I just ran the "${PROGNAME}" script."
exit 0

Save it as "/usr/local/bin/testscript.sh" and run 'sudo chown root.root /usr/local/bin/testscript.sh; sudo chmod 0755 /usr/local/bin/testscript.sh' to set ownership. Now in the "Also Execute" field add the text "/usr/local/bin/testscript.sh" (w/o quotes). Run the backup test again and simultaneously run 'sudo tail /var/log/messages' in a terminal and you should see the above message scroll by.

gtrrockz84 01-11-2012 12:40 PM

hey thanks! Your post gave me some insight in figuring it out. I did what you said but i did not see the message scroll by. but i figure from your example on how to actually write a bash script. And then i did some more googling based on different errors i still kept getting and then found that sudo commands work on "lukcybackup super" and not the normal luckybackup. So i opened luckybackup super user and added the file that contained the bash script and it worked beautifully.

so far so good. Thanks for your help unSpawn!

For all who has similar issue that I had, I wrote a script in gedit, like:
Code:

#!/bin/bash
sudo chmod -R 755 /your/folder
exit 0

save that file as name.sh (or whatever name you want) and then open luckybackup super user, not the normal luckybackup. you can open luckybackup super user in under applications, system tools.
Go to advance, and in the also execute field just add the name.sh file in there.

Use whatever command is applicable to you (ofcourse) instead of chmod. thats about it and it should run with no problem.


All times are GMT -5. The time now is 06:09 AM.