Computing.Net > Forums > Unix > Unix script for 'sp_who'

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Unix script for 'sp_who'

Reply to Message Icon

Name: AceKnocks
Date: October 7, 2005 at 07:06:05 Pacific
OS: solaris
CPU/Ram: n.a
Comment:

Hi,
I want to create a unix script which will keep on executing 'sp_who' for sybase database (name = my_sybase) in every 5 mins.

Please help



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: October 7, 2005 at 09:18:30 Pacific
Reply:

Years ago, I was a sybase admin, but no more. I do have this stub program left over which you can probably modify to call 'sp_who'.

#!/bin/ksh

SERVERNAME="TEST_SERVER"
USER="my_user"
PASSWD="my_pass"
DBNAME="my_sybase"
DBCOMMAND="eval isql -S $SERVERNAME -U $USER -P $PASSWD"
$DBCOMMAND << MSG
use $DBNAME
go
SELECT * FROM test_table
go
MSG
# end script

If you want to call it every 5 minutes, you need to set up cron. This calls my_script every 5 minutes:

# untested
*/5 * * * * my_script



0

Response Number 2
Name: Dlonra
Date: October 7, 2005 at 11:51:24 Pacific
Reply:

cron if you want script to run 24/7.
to run a script you can eyeball:
#!/bin/ksh

SERVERNAME="TEST_SERVER"
USER="my_user"
PASSWD="my_pass"
DBNAME="my_sybase"

while [ true ]
do

DBCOMMAND="eval isql -S $SERVERNAME -U $USER -P $PASSWD"
$DBCOMMAND << MSG
use $DBNAME
go
SELECT * FROM test_table
go
MSG
# end script

sleep 300
done


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Unix script for 'sp_who'

help redoing unix script student db www.computing.net/answers/unix/help-redoing-unix-script-student-db/5151.html

Writing a Unix script to ftp files www.computing.net/answers/unix/writing-a-unix-script-to-ftp-files/3934.html

Unix cmd for find and remove www.computing.net/answers/unix/unix-cmd-for-find-and-remove/2376.html