Welcome to the North American Subaru Impreza Owners Club Monday December 22, 2014
Home Forums WikiNASIOC Products Store Modifications Upgrade Garage
NASIOC
Here you can view your subscribed threads, work with private messages and edit your profile and preferences Home Registration is free! Visit the NASIOC Store NASIOC Rules Search Find other members Frequently Asked Questions Calendar Archive NASIOC Upgrade Garage Logout
Go Back   NASIOC > NASIOC Miscellaneous > Off-Topic

Welcome to NASIOC - The world's largest online community for Subaru enthusiasts!
Welcome to the NASIOC.com Subaru forum.

You are currently viewing our forum as a guest, which gives you limited access to view most discussions and access our other features. By joining our community, free of charge, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is free, fast and simple, so please join our community today!

If you have any problems with the registration process or your account login, please contact us.
* Registered users of the site do not see these ads.
Reply
 
Thread Tools Display Modes
Old 01-28-2005, 03:50 PM   #1
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default UNIX dudes - help with nohup

I have some processes I'm going to be kicking off that'll take a couple of hours to run, and I'd rather not be logged in to run them. So I tried this:

nohup ./somescript.sh -someflag -param1 /path/to/file.xml -param2 /path/to/bla.log &

It starts, directing output to "nohup.out", but immediately stops, and the only thing in nohup.out is "somescript.sh: bad substitution".

Thinking something was wrong with using args like that, I tried writing another script that basically just contains the above call, and tried this:

nohup ./dumbscript.sh &

But, same problem, bad substitution in nohup.out, only this time it says "dumbscript.sh" has the problem.

Any idears? Usually Google Groups has solutions to all things relating to error messages, but I'm not having any luck.
* Registered users of the site do not see these ads.

Last edited by TimStevens; 01-28-2005 at 03:57 PM.
TimStevens is offline   Reply With Quote
Old 01-28-2005, 03:53 PM   #2
Hypernoodle
Scooby Specialist
 
Member#: 12391
Join Date: Nov 2001
Chapter/Region: NESIC
Location: YER.MOMS.A.HAIKU.AND.HERES.WHY
Vehicle:
I did her 5 times
then 7 times, then 5 more

Default

I know this might sound dumb, but try passing the full path for the script and see if that does it.
Hypernoodle is offline   Reply With Quote
Old 01-28-2005, 03:56 PM   #3
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

i was actually using ./, which I forgot to type above, but I'll try that.

In the dumbscript.sh I did use the full path to the other script.
TimStevens is offline   Reply With Quote
Old 01-28-2005, 04:14 PM   #4
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Hrm, no dice. Same error.

I just discovered you can use nohup -p to control a process that's already running, so maybe I'll just kick the app off, get the PID, and do it that way.

Would love to know what the problem is, though, if anyone has any ideas.
TimStevens is offline   Reply With Quote
Old 01-28-2005, 04:23 PM   #5
Hypernoodle
Scooby Specialist
 
Member#: 12391
Join Date: Nov 2001
Chapter/Region: NESIC
Location: YER.MOMS.A.HAIKU.AND.HERES.WHY
Vehicle:
I did her 5 times
then 7 times, then 5 more

Default

Quote:
Originally Posted by TimStevens
Hrm, no dice. Same error.

I just discovered you can use nohup -p to control a process that's already running, so maybe I'll just kick the app off, get the PID, and do it that way.

Would love to know what the problem is, though, if anyone has any ideas.
Okay...

Instead of calling the script directly, preface the full script path with the "sh" command.

nohup sh ./somescript.sh -someflag -param1 /path/to/file.xml -param2 /path/to/bla.log &
Hypernoodle is offline   Reply With Quote
Old 01-28-2005, 04:32 PM   #6
kbcr3
Scooby Specialist
 
Member#: 44170
Join Date: Sep 2003
Chapter/Region: Tri-State
Location: Arlington, VA
Vehicle:
2010 Forester XT
05 and 09 honda ruckus

Default

can you just run it in cron later in the day or night?
kbcr3 is offline   Reply With Quote
Old 01-28-2005, 04:40 PM   #7
bigdweeb
Scooby Specialist
 
Member#: 31035
Join Date: Dec 2002
Chapter/Region: NESIC
Location: Boston
Vehicle:
13 Ford Explorer
14 ISM STi

Default

why not just run screen, start the process and detatch the screen session. Then reattach later to check progress.
bigdweeb is offline   Reply With Quote
Old 01-28-2005, 04:46 PM   #8
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Quote:
Originally Posted by bigdweeb
why not just run screen, start the process and detatch the screen session. Then reattach later to check progress.
You mean Ctrl-Z and bg and fg? These don't work if you log off.

I can't really cron this stuff, since I don't know how long each process will take, and I need to run each in sequence, but need to verify the previous run was successful before kicking the next one off (it's essentially a batch load of data to the DB, the script calls a process to load it). So, I need to start them manually.

I'll try the sh option. My understanding was you only needed that if your files weren't set as executable.
TimStevens is offline   Reply With Quote
Old 01-28-2005, 04:49 PM   #9
bigdweeb
Scooby Specialist
 
Member#: 31035
Join Date: Dec 2002
Chapter/Region: NESIC
Location: Boston
Vehicle:
13 Ford Explorer
14 ISM STi

Default

Quote:
Originally Posted by TimStevens
You mean Ctrl-Z and bg and fg? These don't work if you log off.

I can't really cron this stuff, since I don't know how long each process will take, and I need to run each in sequence, but need to verify the previous run was successful before kicking the next one off (it's essentially a batch load of data to the DB, the script calls a process to load it). So, I need to start them manually.

I'll try the sh option. My understanding was you only needed that if your files weren't set as executable.
no, not what I meant... screen is a process that you can run. I allows you to run a shell and then disconnect from it, but you can leave stuff running still. When you want to check up on things you reconnect to the machine and then reattach to the screen session as if you never left.
bigdweeb is offline   Reply With Quote
Old 01-28-2005, 06:31 PM   #10
Kartoffel
Scooby Specialist
 
Member#: 12976
Join Date: Dec 2001
Chapter/Region: TXIC
Location: Huntsville, Alabamy
Vehicle:
2002 WRX
grocery getter

Default

Yes. screen will get the task done nicely.
Kartoffel is offline   Reply With Quote
Old 01-28-2005, 08:10 PM   #11
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

I've never used screen before, but from the manpage it sounds like it needs a windows manager..? Unfortunately I'm running these commands on a machine I only have telnet access to.
TimStevens is offline   Reply With Quote
Old 01-28-2005, 08:46 PM   #12
Kartoffel
Scooby Specialist
 
Member#: 12976
Join Date: Dec 2001
Chapter/Region: TXIC
Location: Huntsville, Alabamy
Vehicle:
2002 WRX
grocery getter

Default

Quote:
Originally Posted by TimStevens
sounds like it needs a windows manager..?
The "window" is simply your tty. Just play with it locally to get a feel for it.

Once you're logged in, start a screen with
Code:
screen
Start your job(s)
Code:
stuff blah etc
Then detatch screen with ctrl-a, ctrl-d. You are free to log out.

When you log back in later, reattach to screen with
Code:
screen -r
and you'll pick back up right where you left off. Awesome, huh? Screen is good stuff.

You can also use screen to mux two ttys together, so that two users can see the same thing. First user starts screen with `screen' as usual, the second user does `screen -x' to attach to the existing screen. Now, whatever one user types will appear on the other's tty. This is handy for interactively helping n00bs or for collaborative editting, etc.
Kartoffel is offline   Reply With Quote
Old 01-28-2005, 08:56 PM   #13
sct
Scooby Newbie
 
Member#: 20644
Join Date: Jun 2002
Chapter/Region: TXIC
Location: Austin, TX
Default

Quote:
Originally Posted by Kartoffel
Then detatch screen with ctrl-a, ctrl-d. You are free to log out.
Good overview post. The one point I have is that on my boxes it is just "CTRL-A d".

I am using it all weekend to do some server migration. Certiainly one of the most useful tools to a sysadmin or batch processor there is.
sct is offline   Reply With Quote
Old 01-28-2005, 09:14 PM   #14
linux>windows
*** Banned ***
 
Member#: 49517
Join Date: Nov 2003
Chapter/Region: MWSOC
Location: Downtown Grand Rapids, MI
Default

Still need help?
linux>windows is offline   Reply With Quote
Old 01-28-2005, 10:26 PM   #15
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Nice, thanks guys. Appreciate the help. I'll give that a shot when I'm back to work on monday
TimStevens is offline   Reply With Quote
Old 01-28-2005, 10:56 PM   #16
linux>windows
*** Banned ***
 
Member#: 49517
Join Date: Nov 2003
Chapter/Region: MWSOC
Location: Downtown Grand Rapids, MI
Default

oh, good luck..
linux>windows is offline   Reply With Quote
Old 01-29-2005, 01:36 AM   #17
Kartoffel
Scooby Specialist
 
Member#: 12976
Join Date: Dec 2001
Chapter/Region: TXIC
Location: Huntsville, Alabamy
Vehicle:
2002 WRX
grocery getter

Default

Quote:
Originally Posted by TimStevens
Nice, thanks guys. Appreciate the help. I'll give that a shot when I'm back to work on monday
yay for weekends
Kartoffel is offline   Reply With Quote
Old 01-29-2005, 04:59 AM   #18
sct
Scooby Newbie
 
Member#: 20644
Join Date: Jun 2002
Chapter/Region: TXIC
Location: Austin, TX
Default

Weekends are nice. I only have to work part time. Thank the lord I am salary. Oh wait, that isn't so special.
sct is offline   Reply With Quote
Old 01-29-2005, 09:28 AM   #19
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Quote:
Originally Posted by Kartoffel
yay for weekends
Yeah, seriously, it's been a bit of a long week. I'd log in and try it out now, but I'll probably be doing some work over next weekend, so I'll take this weekend to chill out
TimStevens is offline   Reply With Quote
Old 02-17-2005, 03:41 PM   #20
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Thought I'd give this a bump since I finally had time to get back to this.

screen looks like it'd work perfectly, but unfortunately it's a GNU package and the admin won't install anything on there unless there's a system need. I'm sure he'd dig it if he tried it, but alas, it's not going on there.

But, I got nohup to work. Turns out I made a stupid mistake on the script I was calling, forgot the #!/bin/bash at the beginning of the script. Put that in and nohup works fine. Much more clunky than screen sounds, but not much I can do aboot that.

Thanks for the assistance guys.
TimStevens is offline   Reply With Quote
Old 02-17-2005, 04:08 PM   #21
aod
NASIOC Supporter
 
Member#: 7121
Join Date: Jun 2001
Chapter/Region: MWSOC
Location: \_(ツ)LF!
Default

I missed this thread somehow. You should be able to run a process in the background and detach your tty without it killing the process as well. Nohup is not really necessary anymore with shells that have job control. Nohup was necessary back in the days of shells without job control. You can background a process by putting an & at the end of the command line. You should be able to logout at that point and the process will not receive a HUP (Hang UP) signal, hence no need for nohup. Of course, being a programmer I'm sure you are familiar with signal trapping. If you wanted to go a step further just to make sure, you could make your process ignore HUP signals.
aod is online now   Reply With Quote
Old 02-17-2005, 04:11 PM   #22
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Well, it's a Java app, so I'd imagine that's up to what the JVM does with it, and I don't know honestly. It's worth trying, though... after the first batch job completes... which should be sometime tomorrow morning
TimStevens is offline   Reply With Quote
Old 02-17-2005, 04:13 PM   #23
aod
NASIOC Supporter
 
Member#: 7121
Join Date: Jun 2001
Chapter/Region: MWSOC
Location: \_(ツ)LF!
Default

Quote:
Originally Posted by TimStevens
Well, it's a Java app, so I'd imagine that's up to what the JVM does with it, and I don't know honestly. It's worth trying, though... after the first batch job completes... which should be sometime tomorrow morning
Is it just running through jre? If so, you should be able to background it no problem.
aod is online now   Reply With Quote
Old 02-17-2005, 04:14 PM   #24
TimStevens
Scooby Specialist
 
Member#: 4817
Join Date: Mar 2001
Chapter/Region: NESIC
Location: Albanyish, NY
Vehicle:
2012 STI, '02 WRX
'91 MR2, '05 Speed Triple

Default

Yep, the 1.4.2 JVM running on Solaris 8.
TimStevens is offline   Reply With Quote
Old 02-17-2005, 04:16 PM   #25
moktod
Scooby Newbie
 
Member#: 34768
Join Date: Apr 2003
Location: i am everywhere
Vehicle:
2002 Impreza WRX
White

Default

install 'screen'

use it

love it

never look back

-moktod

p.s.

let me know when you have it installed and I will give you my quick howto.
moktod is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with something truenosan Vancouver Impreza Club Forum -- VIC 7 06-02-2010 10:05 PM
Help with greasing up the bushings kmper02 Newbies & FAQs 1 06-02-2010 04:52 PM
Java/J2EE dudes - help me with a DataSource problem re92 Off-Topic 1 03-01-2005 07:36 PM
Need help with some UNIX commands. Kinsbane Off-Topic 9 04-06-2004 12:51 AM
please help with unix PhantomOG Texas Impreza Club Forum -- TXIC 17 10-20-2001 11:11 AM


All times are GMT -4. The time now is 02:54 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Powered by Searchlight © 2014 Axivo Inc.
Copyright ©1999 - 2014, North American Subaru Impreza Owners Club, Inc.