LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2009, 12:13 PM   #1
zogness
LQ Newbie
 
Registered: Apr 2006
Posts: 24

Rep: Reputation: 0
simple scripting problem


I need some simple syntax that will run "shutdown -y now" when scp is no longer running.

This is what I have so far.

while [ "pgrep scp" != "" ] ; do sleep 2; echo "mooo"; done

Of course this fails to do anything except stop printing "mooo" when scp exits.

Should I be using "case" after the echo?

I'm sure there are 20 ways to do this. I am looking for the most concise way; something I can memorize.

I don't really want a complete solution. I want hints and guidance. I should be able to figure this out myself.

Thanks.
 
Old 01-15-2009, 12:40 PM   #2
zogness
LQ Newbie
 
Registered: Apr 2006
Posts: 24

Original Poster
Rep: Reputation: 0
nevermind

while pgrep scp; do echo "mooo" ; sleep 1; done ; shutdown -h now

I forgot that you could run commands AFTER the "done" statement.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Scripting Problem [Comparison of several strings] thomasknowles Programming 7 07-22-2008 07:53 AM
simple scripting help please kb100 Programming 7 08-23-2006 07:31 AM
simple scripting help please kb100 Programming 12 08-18-2006 09:34 AM
simple scripting help please kb100 Programming 3 08-18-2006 09:08 AM
simple shell scripting problem noir911 Programming 11 03-14-2006 02:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration