- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to pass arguments to the script with at comman...
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
Forums
Discussions
Discussions
Discussions
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
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
06-18-2005 12:50 AM
06-18-2005 12:50 AM
I am trying to write a backup script to back up my oracle datafiles and I am trying to pass an argument while executing the script.
eg: sh back_script 2
Now within my script i have specified
cp /home/oracle/example.dbf /home/day$1
Based on the input argument the backup goes to the directory /home/day2.
but when i need to schedule the backup using the at command, i am unable to pass an argument. It says bad date specification.
How best can I achieve my objective.
AJI
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 01:26 AM
06-18-2005 01:26 AM
Re: how to pass arguments to the script with at command
A couple of things to try. First, if you're doing this from the command line, then enter:
at ${time_string}
/bin/sh /path_to_script/back_script 2 &
Another thing you should consider is using cron instead of at. More often than not, you want backup scripts to run periodically, not just once. To do that, execute crontab -e, then enter:
${min} ${hour} ${day} ${month} ${weekday} /path_to_script/back_script 2 > /dev/null 2>&1
If you really need to run this all from a single command line using at, put the commmand entire command in quotes:
at ${time_string} "sh back_script 2"
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 01:43 AM
06-18-2005 01:43 AM
Re: how to pass arguments to the script with at command
Thanks for the reply,
but I will be executing another file "startbackup" where i want to specify something like
at -f backupscript 2 16:45
This 2 has to be passed to backupscript.
Please advice me
AJI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 02:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 02:57 AM
06-18-2005 02:57 AM
Re: how to pass arguments to the script with at command
the command exactly work the way i want from command line.
But you know I want something like
echo "sh backupscript $1" | at 17:51
where $1 is parameter i specify when i run the script like
$ sh startbackup 2
this value 2 should come in the syntax specified by you
thanks in advance
AJI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 03:12 AM
06-18-2005 03:12 AM
Re: how to pass arguments to the script with at command
chmod o+x startbackup
your startbackup script will have a line like this:
at 17:51 /path/to/script/backupscript $1
you invoke your startbackup
/path/to/script/startbackup 2
hope this helps
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 03:29 AM
06-18-2005 03:29 AM
Re: how to pass arguments to the script with at command
I tried this way before, and tried exactly following the way specified by you again, but i am getting bad date specification error.
please advice me,
AJI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 04:42 AM
06-18-2005 04:42 AM
Re: how to pass arguments to the script with at command
Try this:
echo "sh back_script 2" | at now + 1 minutes
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 06:20 AM
06-18-2005 06:20 AM
Re: how to pass arguments to the script with at command
Without those, we are fighting with an enemy that we can not see with our hands tied on our backs. Unfortunately, there is no single solution to any particular problem in unix and there is no blanket solution to a generalized statement. I have learnt this if nothing else in my 15+ years of being a sysadmin.
Please provide as much detail as possible.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 08:09 PM
06-18-2005 08:09 PM
Re: how to pass arguments to the script with at command
It started working by modifying startscript
as
echo "sh backupscript $1" | at 17:51
and now i can run as
$./startscript 2
thanks guys for the support