- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unable to include commands after calling nohup in ...
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
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
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
тАО09-03-2005 09:22 PM
тАО09-03-2005 09:22 PM
I have a script to schedule backups. For this i am using
nohup sh scriptname &
and within scriptname i have an "at command" to schedule the backup.
The issue is within my backup script i have included as follows:
-----------------------------------------
nohup scriptname &
printf "\n\n\n\nScheduled backup at `at -l`"
------------------------------------------
Even though the backup is getting scheduled, when i try to use prinf to display the time it has been scheduled, it does not print.
Please advice how to invoke enter key since when you execute nohup command it requires an enter key to proceed to the prompt
Please advice how to incorporate this
AJi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 09:29 PM
тАО09-03-2005 09:29 PM
Re: Unable to include commands after calling nohup in shell script
What error are u getting in nohup.out file,
Pls give some more info abt the script.
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 09:36 PM
тАО09-03-2005 09:36 PM
Re: Unable to include commands after calling nohup in shell script
I am not getting any errors while issuing the nohup command, the issue is that the command next which does a printf of the `at -l` does not print, since nohup requires enter key to be pressed.
Thanks,
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 09:58 PM
тАО09-03-2005 09:58 PM
Re: Unable to include commands after calling nohup in shell script
Hope this will solve the problem,
make the lines like this :
-----------------------------------------
nohup scriptname &
echo "\n\n\n\nScheduled backup at `at -l`"
------------------------------------------
Just replace "printf" with "echo",
Hope this will work..
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 10:13 PM
тАО09-03-2005 10:13 PM
Re: Unable to include commands after calling nohup in shell script
You can use this also :
-----------------------------------------
nohup scriptname &
print "\n\n\n\nScheduled backup at `at -l`"
------------------------------------------
print will also work ..
Cheers ,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 10:25 PM
тАО09-03-2005 10:25 PM
Re: Unable to include commands after calling nohup in shell script
Thanks for the advice,
But still its not working,
I tried echo as well as print command.
Its not showing the output of at -l in the next line after nohup.
Please advice
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 11:05 PM
тАО09-03-2005 11:05 PM
Re: Unable to include commands after calling nohup in shell script
Try giving , echo "\r" after the command to execute a Carriage Return.
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 11:22 PM
тАО09-03-2005 11:22 PM
Re: Unable to include commands after calling nohup in shell script
"/r" too does'nt work for me
please advice me
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 11:24 PM
тАО09-03-2005 11:24 PM
Re: Unable to include commands after calling nohup in shell script
I mean echo "\r"
Regards
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 11:34 PM
тАО09-03-2005 11:34 PM
Re: Unable to include commands after calling nohup in shell script
you can also try scheduling the backup through cron :
Example:
1.30 1 * * 0 /home/backup_script > /dev/null 2>&1
# at 1.30 Every Sunday.
---------------------------------------
You dont need nohup, for this.
And also wondering why you want to use nohup . Once you given the at command , the backup will be executed at the time , specified by at command , and it will not terminate even you logged out.
Nohup is useful if you are hangup the session , and not applicable with at and cron.
Hope it may help ,
Raj.
---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 11:37 PM
тАО09-03-2005 11:37 PM
Re: Unable to include commands after calling nohup in shell script
the cron entry will be like this:
30 1 * * 0 /home/backup_script > /dev/null 2>&1
(to run the backup at every sunday 1.30)
------
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2005 11:55 PM
тАО09-03-2005 11:55 PM
Re: Unable to include commands after calling nohup in shell script
thanks for the update,
I am aware of the cron job. But this scheduling is not an daily activity, so we cannot schedule it as a cronjob. Similarly we are running a menu based script that will delete decide the backup policy, and accordingly it will delete older file and then schedule the at job. Finally it should print at -l to show the backup user that the schedule was successful.
This backup script i am executing with nohup, which causes the issue, that it does not print later.
Please advice me,
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:01 AM
тАО09-04-2005 12:01 AM
Re: Unable to include commands after calling nohup in shell script
So wihout nohup , does the script prints output of at -l .
i.e If you run like this
sh scriptname &
Raj.
----
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:04 AM
тАО09-04-2005 12:04 AM
Re: Unable to include commands after calling nohup in shell script
yes it works without nohup
But i want to execute within nohup. Please note my question. The issue is with issuing the at -l within nohup command
Please advice
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:17 AM
тАО09-04-2005 12:17 AM
Re: Unable to include commands after calling nohup in shell script
You have wrote the command in two way .
1 nohup sh scriptname &
2.
-----------------------------------------
nohup scriptname &
printf "\n\n\n\nScheduled backup at `at -l`"
------------------------------------------
The 2nd (nohup) command will run successfully , if you have made the script file executable . That is x flag is set.
Pls check,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:20 AM
тАО09-04-2005 12:20 AM
Re: Unable to include commands after calling nohup in shell script
the commad is been called as
nohup scriptname &
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:21 AM
тАО09-04-2005 12:21 AM
Re: Unable to include commands after calling nohup in shell script
I am wondeting , why other peoples are not replying to this thread .
May be you have not assigned any points to your queries:
" I have assigned points to 0 of 33 responses to my questions."
or May be today less poeples are online.
-----
Any way keep on working , the problem will get solve soon.
Cheers.
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:23 AM
тАО09-04-2005 12:23 AM
Re: Unable to include commands after calling nohup in shell script
I too was wondering why others are not replying.
How can i assign point without getting a solution to my issue.
Regards
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 12:34 AM
тАО09-04-2005 12:34 AM
Re: Unable to include commands after calling nohup in shell script
But I am talking about the old issues.
----
Everything seems right in your script and it should give the output ,of `at -l` , as when it is printing the string "Scheduled backup" and the next is `at -l`.
Else you can do it like that ,
You can put this commands in the backup script , where the, at command runs .
---------------------------------------
..
..
at -f scname -t time # assuming this is your at command.
# add the below lines to get the notification .
echo " at Command executed ..at `date` "
echo " Now Notifying to the user.."
at -l > `tty`
####################################
Hope this will help,
Cheers ,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 01:11 AM
тАО09-04-2005 01:11 AM
Re: Unable to include commands after calling nohup in shell script
The solution provided was GUd, but it does not work in my script
AJ1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 01:18 AM
тАО09-04-2005 01:18 AM
Re: Unable to include commands after calling nohup in shell script
I understand that.
But now I am not getting anything furhter for that script problem, as not able to understand as whats wrong, with that. May some other people can give some gud solution.
thx n Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 10:29 PM
тАО09-04-2005 10:29 PM
SolutionDoes the background job "scriptname" terminate at some point - could you not wait for it? Why is it run in the background in any case?
When does the background job actually run the "at" command to schedule the backup? Could you not get the background job to run the "at -l" and write the output to a file, then your foreground job could sit in a loop waiting for the file to be created, list its contents and remove the file?
Just my 10 cents worth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 10:50 PM
тАО09-04-2005 10:50 PM
Re: Unable to include commands after calling nohup in shell script
Thanks for the update,
You were right,It worked.
I issued a sleep for 1 sec and then tried to print.
----------------------------------
nohup /home/orarac/start &
echo "\nScheduled backup at: `at -l`"
sleep 1
cat /home/orarac/nohup.out
------------------------------------
Thanks,
AJi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 10:52 PM
тАО09-04-2005 10:52 PM
Re: Unable to include commands after calling nohup in shell script
#!/bin/ksh
#backup.ksh
nohup ./atscr.ksh &
printf "\n\n\n\nScheduled backup at `at -l`\n"
#!/bin/ksh
#atscr.ksh
at -f test.ksh now + 2 minutes
#!/bin/ksh
#test.ksh
ls
hostname
sleep 10
#end
Command line
# chmod u+x backup.ksh test.ksh atscr.ksh
# rm -f nohup.out
# ./backup.ksh
Sending output to nohup.out
Scheduled backup at user = root 1125916985.a Mon Sep 5 04:43:05 2005
user = root 1125917015.a Mon Sep 5 04:43:35 2005
# cat nohup.out
warning: commands will be executed using /usr/bin/sh
job 1125917056.a at Mon Sep 5 04:44:16 2005
Problem:
Change this nohup scriptname & to (chmod u+x scriptname)nohup ./scriptname &
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-04-2005 10:56 PM
тАО09-04-2005 10:56 PM
Re: Unable to include commands after calling nohup in shell script
thanks guys for the support.
Regards,
AJi