How to make my file backup script run on Salix?

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
User avatar
hakerdefo
Posts: 91
Joined: 9. Dec 2012, 08:12
Contact:

How to make my file backup script run on Salix?

Post by hakerdefo »

I have pieced together a little bash script that creates backup of a file as you open it for editing. Now this script runs fine on Debian and Bodhi but I'm having problems running it on Salix because Salix doesn't use 'sudo'. Using 'su' i ran into difficulties right away. I wanted to copy this script from 'hakbak' folder in my user directory to 'usr/bin' directory. On Debian i would do it like this,

Code: Select all

sudo cp ~/hakbak/hakbaktext.sh /usr/bin
On Salix i did 'su' in terminal and then ran the command,

Code: Select all

cp ~/hakbak/hakbaktext.sh
But it gave me error.

Code: Select all

cp: cannot stat ‘/root/hakbak/hakbaktext.sh’: No such file or directory
I just stopped there. I knew there and then that i would have to make some changes on installation and may be the script it self. I know that Salix-Slackware is not Bodhi-Debian and that's why i'm asking you guys to have a look at my script and suggest me on how to modify it to run on Salix.

Here's a link to my blog post explaining installation and usage of this script,

http://hakerdefo.blogspot.com/2013/05/h ... l-for.html

Cheers!!!
User avatar
aurlaent
Donor
Posts: 106
Joined: 1. Feb 2012, 19:46
Location: Sydney, Australia

Re: How to make my file backup script run on Salix?

Post by aurlaent »

when you use su you "become" root, so ~ is now /root insead of /home/username/

Do you need this script to be available globally? or can you put it in another folder e.g. /home/username/bin and add that to your $PATH
User avatar
hakerdefo
Posts: 91
Joined: 9. Dec 2012, 08:12
Contact:

Re: How to make my file backup script run on Salix?

Post by hakerdefo »

aurlaent wrote:when you use su you "become" root, so ~ is now /root insead of /home/username/

Do you need this script to be available globally? or can you put it in another folder e.g. /home/username/bin and add that to your $PATH
Hi aurlaent! Thanks for your reply!
Sorry i didn't make myself clear in my first post. I can make changes and make it work on my Salix install but i want to add 'install and usage on linux distros without sudo' section in my above mentioned blog article. So i want you guys to have a look at the article and the script and suggest me the required modification so that any reader who doesn't have sudo on his system can follow the article and use the script on his system.
Cheers!!!
User avatar
aurlaent
Donor
Posts: 106
Joined: 1. Feb 2012, 19:46
Location: Sydney, Australia

Re: How to make my file backup script run on Salix?

Post by aurlaent »

The easiest change would be to use the full path, rather than using ~ or to

Code: Select all

cd ~/hakbak
before you

Code: Select all

su -c 'cp hakbaktext.sh /usr/bin'
User avatar
hakerdefo
Posts: 91
Joined: 9. Dec 2012, 08:12
Contact:

Re: How to make my file backup script run on Salix?

Post by hakerdefo »

Thanks aurlaent! That's the best way to go!
Cheers!!!
Post Reply