- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script needed for backup with prompt of date used ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2010 07:06 PM
тАО10-12-2010 07:06 PM
Script needed for backup with prompt of date used in file naming conventions
I am going on vacation and basically i want to create a script where the command
tar -cvf dev/rmt/0m /backup/*[Date name}.Z
Basically I want them to execute the script then the date of the specific backup will be prompted for input.
Here's an example the backup for 10/12/2005.
The files are backed up to /backup/daily and the 3 files are needed to backed up.
jBeforeCob-20101012.Z. jAfterCob-20101012.Z and jReReporter-20101012.Z.
So the 3 files all need to backed up to tape. I just want the user to input the date.
Do these user need root access for this?
Any help would be appreciated, I am going on vacation and I am the only Unix Admin, so I am trying to make easy for non Unix familiar people.
- Tags:
- date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2010 09:03 PM
тАО10-12-2010 09:03 PM
Re: Script needed for backup with prompt of date used in file naming conventions
What's stopping you?
> Do these user need root access for this?
My psychic powers are too weak to tell me
anything about the owner/group or permissions
of these files (or of the tape device).
Why ask? Why not simply try it? Reality is
often more reliable and trustworthy than free
advice on a forum like this one. Especially
when no non-psychic here has the information
needed to justify an opinion.
> [...] then the date of the specific backup
> will be prompted for input.
If the date is always (or usually) today's
date, then you might offer that as a default
value.
> [...] people forget to put tapes, unprotect
> the tapes, etc.
Can a script load the tape drive with a
properly configured tape?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2010 06:27 AM
тАО10-13-2010 06:27 AM
Re: Script needed for backup with prompt of date used in file naming conventions
to get a string from a user on the screen from a running script, the command is "read."
for example, inside a script...
read answer
will wait for the user to input a string, and it will be stored in $answer.
if you run the command
echo $answer
the string in your case the date string would be shown on screen.
a rough example of what you may be looking for:
echo "Enter Date:"
read backupdate
tar -cvf dev/rmt/0m /backup/*${backupdate}.Z
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2010 07:40 AM
тАО10-13-2010 07:40 AM
Re: Script needed for backup with prompt of date used in file naming conventions
Thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2010 08:15 AM
тАО10-13-2010 08:15 AM
Re: Script needed for backup with prompt of date used in file naming conventions
Instead of interactively reading from user input, consider passing the requisite data as an argument to your script. This allows you to 'cron' the script too. In a simple form, you could do:
# cat ./mybackup
#!/usr/bin/sh
[ -z "$1" ] && { echo "Usage $0: backup_date"; exit 1; } || BUDATE=$1
echo "backing up for ${BUDATE}"
#
Regards!
...JRF...