![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Repeating "vi" ex-editor 'command mode' commands | royalibrahim | Shell Programming and Scripting | 0 | 09-25-2007 03:21 AM |
| unix script for repeating a command with a variable | langdatyagi | UNIX for Advanced & Expert Users | 2 | 07-26-2007 08:55 AM |
| Repeating variables in the code | mahalakshmi | Shell Programming and Scripting | 1 | 02-08-2007 07:33 AM |
| Filter out repeating messages | antalexi | SUN Solaris | 2 | 01-31-2005 02:19 PM |
| repeating kernel message | progressdll | UNIX for Advanced & Expert Users | 2 | 07-29-2002 04:18 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Repeating commands in a script
I have written a script that I want to be repeated. The script that I wrote outputs the date, how many people are on the system, how many people logged in before me, and how many people logged in after me. Than what I want it to do is after it outputs the 4 lines I want it to go back to the beginning and start over. How would I go about doing this without using a loop. Is there a command in unix that does this? Thanks for your help.
|
|
||||
|
Quote:
#way1 - with infinite while loop #!/bin/sh while true; do date who | wc -l .. # Sleep for some time to make loop again sleep 2 done exit 0 # way2 - with cron #!/bin/sh date who | wc -l .. exit 0 # chmod 755 <script> crontab -e * * * * * <script with absolute path> 1>/dev/null 2>&1 so that script will be executed everyday on everyday hour.. HTH. |
|
|||||
|
Quote:
Code:
0 * * * * <script with absolute path> 1>/dev/null 2>&1 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|