I created a basic script to backup my router, which runs a linux firmware called OpenWrt. The script uses dd to image the router's RAM blocks, copy's the file to local usb storage, and then uploads it to a remote ISP personal ftp account. What I would like to happen though is that instead of manually naming the .bin file (router image) in the script, I would like the script to prompt to name the file before the dd, cp, and ftp upload process.
Here is the script that I created for a better understanding:
Thanks in avance for those that can help me out.
Last edited by bartus11; 01-04-2014 at 10:07 AM..
Reason: Please use code tags instead of quote tags
Thank you for your input. However, what I'm looking for is for the script to prompt to enter the in a desired file name for the backup file instead of specifying the filename right in the script.
I created a basic script to backup my router, which runs a linux firmware called OpenWrt. The script uses dd to image the router's RAM blocks, copy's the file to local usb storage, and then uploads it to a remote ISP personal ftp account. What I would like to happen though is that instead of manually naming the .bin file (router image) in the script, I would like the script to prompt to name the file before the dd, cp, and ftp upload process.
Here is the script that I created for a better understanding:
Thanks in avance for those that can help me out.
Your request is confusing.
Do you want the script to prompt for the single filename to replace /tmp/ask-for-file-name.bin?
Why does the user need to enter a filename at all? Why shouldn't the script create its own filename (indicating the date and time of the backup) without involving the user? Do you think the user is going to need to specify a directory other than /tmp to hold the temporary file? (If so, removing /tmp/*.bin at the end of the script also needs to be changed!)
If the script has to be given the filename for some reason, is there a reason why the user can't give the filename as a command line operand as suggested by kshji? Would you like the script to accept a command line operand as the temporary filename, but to prompt for it if no operand is given?
Do you realize that your backup of /dev/mtd1 overwrites your backup of /dev/mtd0, your backup of /dev/mtd2 overwrites your backup of /dev/mtd1, your backup of /dev/mtd3 overwrites your backup of /dev/mtd2, your backup of /dev/mtd4 overwrites your backup of /dev/mtd3, and your backup of /dev/mtd5 overwrites your backup of /dev/mtd4? So the only thing this script backs up is /dev/mtd5.
Why is your script removing all filenames ending with .bin from /tmp? Why not just remove the file you created?
I assume that you realize that since you never check for errors, any failed backup will cause all backups to be destroyed. Wouldn't it be better to keep your previous backup at least until you have confirmed that your new backup completed successfully and was successfully copied to the corresponding backup directory?
requirement : I need to read a text file and find out which particular line has highest charcters on it using the shell script.
I tried & was able to find out only for one line. I could not able to find out for the entire the line.
sed -n '10 p' ctstest.sh | wc -w
Please guide me... (5 Replies)
Hi,
I am trying to backup all *.tar files from a legacy Linux to a portable harddrive.
find . -name "*.tar" -exec cp {} /media/mypassport/backup \;
I found that there are files with the same filenames and they were overwritten
in the destination folder. They are coming from different... (4 Replies)
HI all, im new to shell scripting. need your guidence for my script. i wrote one script and is attached here
Im explaining the requirement of script.
AIM: Shell script to run automatically as per scheduled and backup few network devices configurations. Script will contain a set of commands... (4 Replies)
Hi,
I am new in ksh scripting and if anyone can help that would be great.
I'm writing a script which will SSH to several machines and then would append a certain file from a NAS to the /etc/sudoers file
the problem i am having is after the script connects to a certain server the commands are... (7 Replies)
I have a simple script. Do you know what I got this error?
./total_memory.ksh: line 5: '
Thanks
#! /bin/bash
setmem=30177660
totalMemory= grep MemTotal /proc/meminfo | awk '{print $2}'
if ; then
echo "Total memory $totalMemory is less than :$setmem"
exit 1
... (3 Replies)
Hey all, I need some assistance. I'm writing a script to eject tapes from a tape library, but the library is not a queued system and can only eject 15 tapes at a time.
I added paste -d : -s so that it goes through full_tapes and puts each media_id on one line separated by the :.
Now I'm... (2 Replies)
When I run this command (showstatus <username> <dbname>) in the prompt, the following will be displayed in the screen:
1. Show processes
2. Start process
3. Stop process
4. Go back to prompt
Once i choose/type Option "1" (which is Show processes), it will display the list of processes... (5 Replies)
Hello All,
I need to develop a script(SH]) to generate a comparison file between two files old and new file.The script takes in parameter the old file path and the new file path. And the script generates a file containing the comparison between the two files with this details:
- Keys... (2 Replies)
I need to modify a script to send an attatched file. I have researched and read the faq's but have not found a solution for my script. Here is a copy of the code I am using:
#!/bin/sh
mysqldump --opt --skip-add-locks --user=****** --password=******* databasename | gzip >... (3 Replies)
Hey everyone, I'm newer than new when it comes to this ksh and scripting stuff, and unix in general. I have been thrown into a task at work that
A: They expect me to come up to speed on,
B: Show I can do this. (Program for the workgroup)
Here's the script, part of it, from the overall... (3 Replies)