Re: [newbie] Set Backup
Charles Muller wrote: I had thought that I could run this file by going to the /chuck directory and typing the file name. But it doesn't run. I get the response: bash: backup: command not found Can someone tell me what I am missing here? I am sorry to be so slow. Thanks again, Chuck Hi. It might not make any difference at all, but have you tried it with: ./yourfilename Just a thought. -- /\ DarkLord \/ Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
Obviously, I am somewhat dense, but after all the feedback on creating an executable file to run my backups, apparently I am still missing something. I created a text file named backup which I have placed in my home directory, named /home/chuck. The file contains the following lines: --- #!/bin/bash tar cvzfP /mnt/win_d/linux-bak/home.tar.gz /home tar cvzfP /mnt/win_d/linux-bak/evol.tar.gz /evolution -- After creating this file, I tried to make it executable by typing chmod +x backup while in the same directory. I assume this worked since no error messages were generated. I had thought that I could run this file by going to the /chuck directory and typing the file name. But it doesn't run. I get the response: bash: backup: command not found Can someone tell me what I am missing here? I am sorry to be so slow. Thanks again, Chuck On Fri, 15 Feb 2002 09:31:09 - Barran, Richard [EMAIL PROTECTED] revealed these words to me: Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Thanks, Richard .sh is just a convention so users can see what interpreter is to be used with the script ( .csh, .ksh, .py are some of the other endings but the list does not end there). you could make it end in '.nonsense' and it will be executed by the interpreter specified by its first line (i.e #!/bin/bash), or if it is still missing, the current interpreter (which is your shell). echo your PATH environment ( $ echo $PATH ) and see if there is a lone dot in the resulting list of colon-delimited directories. i assume you have it which is considered by many to be a security risk. the default setting is to exclude the current directory from the PATH variable to limit the potential of running a malicious executable placed in a directory which is named after a common utility. here is a scenario. assuming your PATH variable looks like this .:/bin/:/usr/local/bin:... and an intruder with 'maliscious intent' ( a hacker or a friend trying to put a trick on you) got an access to your account and created a script containing the following code: #!/bin/bash rm -rf ~ echo Hi, you just toasted you home directory! Have a nice day. and saved it on your home directory with the filename 'ls' with matching execute permissions. then you log-in, was put in your home directory. you issued ls to get a directory listing. since bash will be looking first for a ls executable in the current directory (look at the PATH variable), you could just guess how big the intruder's smile would be after that moment. *grin* ciao! -- Programming, an artform that fights back. = Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City Tel# 638-3070 loc. 72 Fax# 638-3079 = Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
try ./backup -Eric On February 16, 2002 09:27 pm, Charles Muller wrote: Obviously, I am somewhat dense, but after all the feedback on creating an executable file to run my backups, apparently I am still missing something. I created a text file named backup which I have placed in my home directory, named /home/chuck. The file contains the following lines: --- #!/bin/bash tar cvzfP /mnt/win_d/linux-bak/home.tar.gz /home tar cvzfP /mnt/win_d/linux-bak/evol.tar.gz /evolution -- After creating this file, I tried to make it executable by typing chmod +x backup while in the same directory. I assume this worked since no error messages were generated. I had thought that I could run this file by going to the /chuck directory and typing the file name. But it doesn't run. I get the response: bash: backup: command not found Can someone tell me what I am missing here? I am sorry to be so slow. Thanks again, Chuck On Fri, 15 Feb 2002 09:31:09 - Barran, Richard [EMAIL PROTECTED] revealed these words to me: Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Thanks, Richard .sh is just a convention so users can see what interpreter is to be used with the script ( .csh, .ksh, .py are some of the other endings but the list does not end there). you could make it end in '.nonsense' and it will be executed by the interpreter specified by its first line (i.e #!/bin/bash), or if it is still missing, the current interpreter (which is your shell). echo your PATH environment ( $ echo $PATH ) and see if there is a lone dot in the resulting list of colon-delimited directories. i assume you have it which is considered by many to be a security risk. the default setting is to exclude the current directory from the PATH variable to limit the potential of running a malicious executable placed in a directory which is named after a common utility. here is a scenario. assuming your PATH variable looks like this .:/bin/:/usr/local/bin:... and an intruder with 'maliscious intent' ( a hacker or a friend trying to put a trick on you) got an access to your account and created a script containing the following code: #!/bin/bash rm -rf ~ echo Hi, you just toasted you home directory! Have a nice day. and saved it on your home directory with the filename 'ls' with matching execute permissions. then you log-in, was put in your home directory. you issued ls to get a directory listing. since bash will be looking first for a ls executable in the current directory (look at the PATH variable), you could just guess how big the intruder's smile would be after that moment. *grin* ciao! -- Programming, an artform that fights back. = Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City Tel# 638-3070 loc. 72 Fax# 638-3079 = Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com -- arctic bears - email and name services 25 email addresses@yourdomain CA$11.95/month DNS starting at CA$3.49/month - domains from CA$25.95/year for details contact [EMAIL PROTECTED] or visit http://www.arcticbears.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
This is because '.' (the current directory) is not included in $PATH by default for security reasons. Hence, to run 'backup' from within ~chuck, the command would be './chuck' . Otherwise it will search the current $PATH. Michael -- Michael Viron [EMAIL PROTECTED] Project Manager / Primary Developer / Schoolforge Representative General Education Online At 02:27 PM 02/17/2002 +0900, Charles Muller wrote: Obviously, I am somewhat dense, but after all the feedback on creating an executable file to run my backups, apparently I am still missing something. I created a text file named backup which I have placed in my home directory, named /home/chuck. The file contains the following lines: --- #!/bin/bash tar cvzfP /mnt/win_d/linux-bak/home.tar.gz /home tar cvzfP /mnt/win_d/linux-bak/evol.tar.gz /evolution -- After creating this file, I tried to make it executable by typing chmod +x backup while in the same directory. I assume this worked since no error messages were generated. I had thought that I could run this file by going to the /chuck directory and typing the file name. But it doesn't run. I get the response: bash: backup: command not found Can someone tell me what I am missing here? I am sorry to be so slow. Thanks again, Chuck On Fri, 15 Feb 2002 09:31:09 - Barran, Richard [EMAIL PROTECTED] revealed these words to me: Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Thanks, Richard .sh is just a convention so users can see what interpreter is to be used with the script ( .csh, .ksh, .py are some of the other endings but the list does not end there). you could make it end in '.nonsense' and it will be executed by the interpreter specified by its first line (i.e #!/bin/bash), or if it is still missing, the current interpreter (which is your shell). echo your PATH environment ( $ echo $PATH ) and see if there is a lone dot in the resulting list of colon-delimited directories. i assume you have it which is considered by many to be a security risk. the default setting is to exclude the current directory from the PATH variable to limit the potential of running a malicious executable placed in a directory which is named after a common utility. here is a scenario. assuming your PATH variable looks like this .:/bin/:/usr/local/bin:... and an intruder with 'maliscious intent' ( a hacker or a friend trying to put a trick on you) got an access to your account and created a script containing the following code: #!/bin/bash rm -rf ~ echo Hi, you just toasted you home directory! Have a nice day. and saved it on your home directory with the filename 'ls' with matching execute permissions. then you log-in, was put in your home directory. you issued ls to get a directory listing. since bash will be looking first for a ls executable in the current directory (look at the PATH variable), you could just guess how big the intruder's smile would be after that moment. *grin* ciao! -- Programming, an artform that fights back. = Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City Tel# 638-3070 loc. 72 Fax# 638-3079 = Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
17 Feb 2002 14:27:46 +0900: In attempt to throw the authorities off his trail, Charles Muller [EMAIL PROTECTED] transmitted: I had thought that I could run this file by going to the /chuck directory and typing the file name. But it doesn't run. I get the response: bash: backup: command not found Can someone tell me what I am missing here? I am sorry to be so slow. Chuck, The backup script is a program. BASH only looks for programs which are in your PATH environment variable (e.g., /bin;/sbin;/usr/bin/;/usr/local/bin... etc.) unless you specify the path to the executable. Now you can run your backup script in two ways ('$' means normal user BASH prompt): $ /chuck/backup or $ cd /chuck/ $ ./backup # this means you tell the interpreter to look in the current directory not in the PATH But both those options involve typing, and I hate typing (well, excessive typing, that is)! I would recommend either of the following: 1. Create a subdirectory within /chuck called /bin and then add that to your path by modifying your .bashrc, or 2. Add an alias in your .bashrc which points to /chuck/backup Just open your ~/.bashrc file in any text editor and you can find both the list of aliases (towards the top) and the PATH variable (at the bottom). The above changes should be self-explanatory. I prefer the first alternative since it inclines you towards sticking all executable scripts in one directory, instead of having them clutter up your /chuck/ directory. As a general rule, put all the stuff that belongs together, like maintenance scripts in its own directory. Hope that helps. - Chris Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
On Sun, 2002-02-17 at 14:32, Chris Keelan wrote: 1. Create a subdirectory within /chuck called /bin and then add that to your path by modifying your .bashrc, or This worked wonderfully. Thanks so much for taking the time to explain this. Chuck Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
RE: [newbie] Set Backup
I have a backup that I want to run daily, that goes something like this $ tar cvzf /mnt/win_d/docs/e-mail/evolution/evol.tar.gz /home/chuck/evolution I would like to save this in a file that I can run as a command, like a BAT file in DOS. I assume then, that I would save this script in a text file. Then, what else should I do, in terms of naming, or other preparation, to have it available as a command? You can name the file anything you want. Linux supported long names long before Windows/Dos did. Then you can run chmod +x filename to make it executable (set the execute attribute). After that you can run it as./filename ./ means in this directory Paul Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Thanks, Richard *** This e-mail and its attachments are intended for the above named recipient(s) only and are confidential and may be privileged. If they have come to you in error you must take no action based on them, nor must you copy or disclose them or any part of their contents to any person or organisation; please notify the sender immediately and delete this e-mail and its attachments from your computer system. Please note that Internet communications are not necessarily secure and may be changed, intercepted or corrupted. We advise that you understand and observe this lack of security when e-mailing us and we will not accept any liability for any such changes, interceptions or corruptions. Although we have taken steps to ensure that this e-mail and its attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. Copyright in this e-mail and attachments created by us belongs to Littlewoods. Littlewoods takes steps to prohibit the transmission of offensive, obscene or discriminatory material. If this message contains inappropriate material please forward the e-mail intact to [EMAIL PROTECTED] and it will be investigated. Statements and opinions contained in this e-mail may not necessarily represent those of Littlewoods. Please note that e-mail communication may be monitored. Registered office: Littlewoods Retail Limited, Sir John Moores Building, 100 Old Hall Street, Liverpool, L70 1AB Registered no: 421258 http://www.littlewoods.com *** Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
On Friday 15 February 2002 11:31, Barran, Richard wrote: Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? It's just a convention, so you know it's a script. If it's marked as an executable, the system will execute it whatever (though you need to have something like #!/bin/bash at the beginning). Same principle applies to Perl scripts - a lot of people suffeix them with .pl, but it's not necessary (may help your text editor to recognise them, though, so you get the right highlighting). Robin -- Never mind the quality, feel the bandwidth. Robin Turner IDMYO, Bilkent Universitesi Ankara 06533 Turkey http://www.bilkent.edu.tr/~robin Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
On Fri, 15 Feb 2002 09:31:09 - Barran, Richard [EMAIL PROTECTED] revealed these words to me: Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Thanks, Richard .sh is just a convention so users can see what interpreter is to be used with the script ( .csh, .ksh, .py are some of the other endings but the list does not end there). you could make it end in '.nonsense' and it will be executed by the interpreter specified by its first line (i.e #!/bin/bash), or if it is still missing, the current interpreter (which is your shell). echo your PATH environment ( $ echo $PATH ) and see if there is a lone dot in the resulting list of colon-delimited directories. i assume you have it which is considered by many to be a security risk. the default setting is to exclude the current directory from the PATH variable to limit the potential of running a malicious executable placed in a directory which is named after a common utility. here is a scenario. assuming your PATH variable looks like this .:/bin/:/usr/local/bin:... and an intruder with 'maliscious intent' ( a hacker or a friend trying to put a trick on you) got an access to your account and created a script containing the following code: #!/bin/bash rm -rf ~ echo Hi, you just toasted you home directory! Have a nice day. and saved it on your home directory with the filename 'ls' with matching execute permissions. then you log-in, was put in your home directory. you issued ls to get a directory listing. since bash will be looking first for a ls executable in the current directory (look at the PATH variable), you could just guess how big the intruder's smile would be after that moment. *grin* ciao! -- Programming, an artform that fights back. = Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City Tel# 638-3070 loc. 72 Fax# 638-3079 = Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
Barran, Richard wrote: Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Yes, maybe. Does this work because you have . on your path, or does it so happen that you usually write scripts and store them in a directory that is on the path? Putting . on the path is a security concern, in that someone with access to your system could put a file in your directory named, for example ls that would act like ls plus do something nefarious. Randy Kramer PS: I thought the shebang line was required (!/bin/bash), or is it only required if you are running a script that is for other than the default shell? Even so, it might be good practice to always include the shebang line -- then it may be more likely to work if you take the script to another system. Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
RE: [newbie] Set Backup
it doesn't have to end in .sh you can just make it executable: chmod 755 myscipt. in the top line should be something like this: #!/bin/sh then leave a blank line, and then add your commands to it.. I usually put my home grown scripts into /usr/sbin then I always have them in my path, and don't have to use ./ or the full path. rgds Frank -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Barran, Richard Sent: Friday, 15 February 2002 5:31 PM To: '[EMAIL PROTECTED]' Subject: RE: [newbie] Set Backup I have a backup that I want to run daily, that goes something like this $ tar cvzf /mnt/win_d/docs/e-mail/evolution/evol.tar.gz /home/chuck/evolution I would like to save this in a file that I can run as a command, like a BAT file in DOS. I assume then, that I would save this script in a text file. Then, what else should I do, in terms of naming, or other preparation, to have it available as a command? You can name the file anything you want. Linux supported long names long before Windows/Dos did. Then you can run chmod +x filename to make it executable (set the execute attribute). After that you can run it as./filename ./ means in this directory Paul Speaking as a newbie... I thought scripts had to end with a .sh? Or is that just a convention? Also, when I want to run a script I've written myself, I just change to the directory the script is kept in, and type the script name. I don't prefix it with a ./ Am I missing something here? Thanks, Richard *** This e-mail and its attachments are intended for the above named recipient(s) only and are confidential and may be privileged. If they have come to you in error you must take no action based on them, nor must you copy or disclose them or any part of their contents to any person or organisation; please notify the sender immediately and delete this e-mail and its attachments from your computer system. Please note that Internet communications are not necessarily secure and may be changed, intercepted or corrupted. We advise that you understand and observe this lack of security when e-mailing us and we will not accept any liability for any such changes, interceptions or corruptions. Although we have taken steps to ensure that this e-mail and its attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. Copyright in this e-mail and attachments created by us belongs to Littlewoods. Littlewoods takes steps to prohibit the transmission of offensive, obscene or discriminatory material. If this message contains inappropriate material please forward the e-mail intact to [EMAIL PROTECTED] and it will be investigated. Statements and opinions contained in this e-mail may not necessarily represent those of Littlewoods. Please note that e-mail communication may be monitored. Registered office: Littlewoods Retail Limited, Sir John Moores Building, 100 Old Hall Street, Liverpool, L70 1AB Registered no: 421258 http://www.littlewoods.com *** Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
[newbie] Set Backup
I have been going through some Linux books, and I get the general idea, but I am not sure exactly how to go about this. I have a backup that I want to run daily, that goes something like this $ tar cvzf /mnt/win_d/docs/e-mail/evolution/evol.tar.gz /home/chuck/evolution I would like to save this in a file that I can run as a command, like a BAT file in DOS. I assume then, that I would save this script in a text file. Then, what else should I do, in terms of naming, or other preparation, to have it available as a command? Thanks, Chuck Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
On 15 Feb 2002 14:42:50 +0900 Charles wrote: I have been going through some Linux books, and I get the general idea, but I am not sure exactly how to go about this. I have a backup that I want to run daily, that goes something like this $ tar cvzf /mnt/win_d/docs/e-mail/evolution/evol.tar.gz /home/chuck/evolution I would like to save this in a file that I can run as a command, like a BAT file in DOS. I assume then, that I would save this script in a text file. Then, what else should I do, in terms of naming, or other preparation, to have it available as a command? You can name the file anything you want. Linux supported long names long before Windows/Dos did. Then you can run chmod +x filename to make it executable (set the execute attribute). After that you can run it as./filename ./ means in this directory Paul -- The key to change . . . is to let go of fear. -Rosanne Cash http://nlpagan.net - Registered Linux User 174403 Linux Mandrake 8.0 - Sylpheed 0.7.1 Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Set Backup
On 15 Feb 2002 14:42:50 +0900 Charles Muller [EMAIL PROTECTED] revealed these words to me: I have been going through some Linux books, and I get the general idea, but I am not sure exactly how to go about this. I have a backup that I want to run daily, that goes something like this $ tar cvzf /mnt/win_d/docs/e-mail/evolution/evol.tar.gz /home/chuck/evolution I would like to save this in a file that I can run as a command, like a BAT file in DOS. I assume then, that I would save this script in a text file. Then, what else should I do, in terms of naming, or other preparation, to have it available as a command? Thanks, Chuck if you want an incremental backup (meaning the previous day's mail is saved), try this instead tar zcvf /mnt/win_d/docs/e-mail/evolution/evol-`date +%Y%m%d`.tgz /home/chuck/evolution and put it in the cron jobs to be executed daily(search the archives on how to submit a job to cron). this way your backups have the date on their filename. ciao! -- Programming, an artform that fights back. = Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City Tel# 638-3070 loc. 72 Fax# 638-3079 = Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com