Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-21-2002, 11:57 AM   PM User | #1
renoboi
New Coder

 
Join Date: Jul 2002
Location: Reno, NV
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
renoboi is an unknown quantity at this point
System commands

I'm running WinNT5.1 w/ Apache2.

in winnt theres a command run from the cmd prompt that allows you to send a console message to any user or computer on the network.
MSG /SERVER:servername [username] [message]

I want to write a script that will run that command and insert form variables where they need to be (servername,username,message,etc...)

Any Ideas?
renoboi is offline   Reply With Quote
Old 09-21-2002, 01:07 PM   PM User | #2
renoboi
New Coder

 
Join Date: Jul 2002
Location: Reno, NV
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
renoboi is an unknown quantity at this point
Well I'm a moron!

system ("msg /server:$server $user $msg");

that was easy.

Now, is there a way to display the output of that command in the browser????
renoboi is offline   Reply With Quote
Old 09-23-2002, 10:51 AM   PM User | #3
renoboi
New Coder

 
Join Date: Jul 2002
Location: Reno, NV
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
renoboi is an unknown quantity at this point
ok, here's what I did.

@server = system ("msg /server:$server \"$user\" \"$msg\"");
foreach $message (@server)
{
print $message;
}

Now it prints "0" if the command completes, and "256" if it doesn't.

Does anybody have any ideas how to get it to print command output?
renoboi is offline   Reply With Quote
Old 09-23-2002, 11:34 AM   PM User | #4
Alekz
Regular Coder

 
Join Date: Sep 2002
Location: Bulgaria
Posts: 123
Thanks: 0
Thanked 0 Times in 0 Posts
Alekz is on a distinguished road
Something like:
print $message >> LPT1;
?

Alex
Alekz is offline   Reply With Quote
Old 09-27-2002, 09:48 AM   PM User | #5
renoboi
New Coder

 
Join Date: Jul 2002
Location: Reno, NV
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
renoboi is an unknown quantity at this point
not what i meant. print to screen. i've pretty much given up though. i just wrote a script to print messages based on error codes. it'll work for what I need it to do. thanks anyway everyone.
renoboi is offline   Reply With Quote
Old 09-28-2002, 12:46 AM   PM User | #6
Mouldy_Goat
Regular Coder

 
Join Date: Jul 2002
Location: London, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Mouldy_Goat is an unknown quantity at this point
You could always just use something like:
Code:
print `msg /server:$server $user $msg`;
Note the use of backticks for command execution.
Mouldy_Goat is offline   Reply With Quote
Old 09-28-2002, 09:11 AM   PM User | #7
renoboi
New Coder

 
Join Date: Jul 2002
Location: Reno, NV
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
renoboi is an unknown quantity at this point
If there's an error, the output at the command promt gives a reason. User not connected, User does not exist, etc... I was trying to figure out a way to make the browser display that error. instead it just gave numbers. but i figured it out.

0 = OK
256 = Not Connected

For anything else it doesn't do anything. so i made a script that works with that.

But thatnks again for the help.
renoboi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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


All times are GMT +1. The time now is 01:04 PM.


Advertisement
Log in to turn off these ads.