|
|
|
|
Thread Tools | Display Modes |
01-28-2005, 02:50 PM | #1 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
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 02:57 PM. |
01-28-2005, 02:53 PM | #2 |
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 |
I know this might sound dumb, but try passing the full path for the script and see if that does it.
|
01-28-2005, 02:56 PM | #3 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
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. |
01-28-2005, 03:14 PM | #4 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
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. |
01-28-2005, 03:23 PM | #5 | |
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 |
Quote:
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 & |
|
01-28-2005, 03:32 PM | #6 |
Scooby Specialist
Member#: 44170
Join Date: Sep 2003
Chapter/Region:
Tri-State
Location: Arlington, VA
Vehicle:2010 Forester XT 05 and 09 honda ruckus |
can you just run it in cron later in the day or night?
|
01-28-2005, 03:40 PM | #7 |
Scooby Specialist
Member#: 31035
Join Date: Dec 2002
Chapter/Region:
NESIC
Location: Boston
Vehicle:10 Mazda Miata 21 CWP Outback XT |
why not just run screen, start the process and detatch the screen session. Then reattach later to check progress.
|
01-28-2005, 03:46 PM | #8 | |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
Quote:
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. |
|
01-28-2005, 03:49 PM | #9 | |
Scooby Specialist
Member#: 31035
Join Date: Dec 2002
Chapter/Region:
NESIC
Location: Boston
Vehicle:10 Mazda Miata 21 CWP Outback XT |
Quote:
|
|
01-28-2005, 05:31 PM | #10 |
Scooby Specialist
Member#: 12976
Join Date: Dec 2001
Chapter/Region:
TXIC
Location: Huntsville, Alabamy
Vehicle:2002 WRX grocery getter |
Yes. screen will get the task done nicely.
|
01-28-2005, 07:10 PM | #11 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
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.
|
01-28-2005, 07:46 PM | #12 | |
Scooby Specialist
Member#: 12976
Join Date: Dec 2001
Chapter/Region:
TXIC
Location: Huntsville, Alabamy
Vehicle:2002 WRX grocery getter |
Quote:
Once you're logged in, start a screen with Code:
screen Code:
stuff blah etc When you log back in later, reattach to screen with Code:
screen -r 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. |
|
01-28-2005, 07:56 PM | #13 | |
Scooby Newbie
Member#: 20644
Join Date: Jun 2002
Chapter/Region:
TXIC
Location: Austin, TX
|
Quote:
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. |
|
01-28-2005, 08:14 PM | #14 |
*** Banned ***
Member#: 49517
Join Date: Nov 2003
Chapter/Region:
MWSOC
Location: Downtown Grand Rapids, MI
|
Still need help?
|
01-28-2005, 09:26 PM | #15 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
Nice, thanks guys. Appreciate the help. I'll give that a shot when I'm back to work on monday
|
01-28-2005, 09:56 PM | #16 |
*** Banned ***
Member#: 49517
Join Date: Nov 2003
Chapter/Region:
MWSOC
Location: Downtown Grand Rapids, MI
|
oh, good luck..
|
01-29-2005, 12:36 AM | #17 | |
Scooby Specialist
Member#: 12976
Join Date: Dec 2001
Chapter/Region:
TXIC
Location: Huntsville, Alabamy
Vehicle:2002 WRX grocery getter |
Quote:
|
|
01-29-2005, 03:59 AM | #18 |
Scooby Newbie
Member#: 20644
Join Date: Jun 2002
Chapter/Region:
TXIC
Location: Austin, TX
|
Weekends are nice. I only have to work part time. Thank the lord I am salary. Oh wait, that isn't so special.
|
01-29-2005, 08:28 AM | #19 | |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
Quote:
|
|
02-17-2005, 02:41 PM | #20 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
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. |
02-17-2005, 03:08 PM | #21 |
Scooby Newbie
Member#: 7121
Join Date: Jun 2001
Chapter/Region:
MWSOC
Location: D2F.1 = D2F.2, D2F.3 = D2F.4
|
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.
|
02-17-2005, 03:11 PM | #22 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
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
|
02-17-2005, 03:13 PM | #23 | |
Scooby Newbie
Member#: 7121
Join Date: Jun 2001
Chapter/Region:
MWSOC
Location: D2F.1 = D2F.2, D2F.3 = D2F.4
|
Quote:
|
|
02-17-2005, 03:14 PM | #24 |
Scooby Specialist
Member#: 4817
Join Date: Mar 2001
Chapter/Region:
NESIC
Location: Albanyish, NY
|
Yep, the 1.4.2 JVM running on Solaris 8.
|
02-17-2005, 03:16 PM | #25 |
Scooby Newbie
Member#: 34768
Join Date: Apr 2003
Location: i am everywhere
Vehicle:2002 Impreza WRX White |
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. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need help with something | truenosan | Vancouver Impreza Club Forum -- VIC | 7 | 06-02-2010 09:05 PM |
Help with greasing up the bushings | kmper02 | Newbies & FAQs | 1 | 06-02-2010 03:52 PM |
Java/J2EE dudes - help me with a DataSource problem | re92 | Off-Topic | 1 | 03-01-2005 06:36 PM |
Need help with some UNIX commands. | Kinsbane | Off-Topic | 9 | 04-05-2004 11:51 PM |
please help with unix | PhantomOG | Texas Impreza Club Forum -- TXIC | 17 | 10-20-2001 10:11 AM |