But thanks again for putting me on to this. This has allowed me to use the "exit" command from the hlds/srcds console which is much better than the "killall" command I was using because it shuts the server down properly by kicking clients with a reason, and closes and saves the log file.
Drek David A. Parker wrote: > I bet you needed to replace the space within the command string with > "\040", like this: > > su - cc-server -c "screen -S srcds -X eval 'stuff sm_csay\040test\015'" > > I didn't catch that there was a space between "sm_csay" and "test" > before, and I forgot to mention that you need to use the "\040" escape > sequence in its place. > > - Dave > > Crazy Canucks wrote: > >> Well, maybe that wasn't it. What I was trying to do was use SourceMod >> and AMX Mod X commands from the console. This is what I've come up with >> now that works. >> >> command="say test\015";su -c "screen -S srcds -X eval 'stuff >> \"$command\"'" cc-server >> >> I expect that I don't need the $command variable, but I am going to be >> using this in a script anyway, so the contents of the command will be in >> a variable. So what was required was the escaped double quotes. >> >> Drek >> >> Crazy Canucks wrote: >> >>> I think I was flummoxed by a charset problem. I cut and pasted from >>> your post, and I think some of the characters were screwed up by the cut >>> and paste. Anyway, it's working now, thanks very much. >>> >>> Drek >>> >>> David A. Parker wrote: >>> >>> >>>> That's odd. It works on my TF2 server just fine, using su in the same >>>> way you tried. The screen is owned by the srcds user, but if I log in >>>> as my regular user, I can do this: >>>> >>>> su - srcds -c "screen -S tf2-server -X eval 'stuff status\015'" >>>> >>>> I enter the srcds user's password, and then the status command will run >>>> on the server's console. >>>> >>>> Have you tried logging in directly as the screen's owner (instead of >>>> going through "su") and trying the screen command that way? >>>> >>>> Crazy Canucks wrote: >>>> >>>> >>>> >>>>> That made no difference. Any chance it is a charset issue with the 015 >>>>> ascii code? I think the charset for my server is utf-8. >>>>> >>>>> Although come to think of it, that probably isn't the issue, as when I >>>>> look at the console, there is nothing there at all, so it probably isn't >>>>> an issue with the return character. I'll do some more futzing about... >>>>> >>>>> Drek >>>>> >>>>> David Parker wrote: >>>>> >>>>> >>>>> >>>>>> The way you have it written, cc-server is the user and srcds is the name >>>>>> of the screen. Is this correct? If it is, this might work better: >>>>>> >>>>>> su - cc-server -c "screen -S srcds -X eval 'stuff sm_csay test\015'" >>>>>> >>>>>> - Dave >>>>>> >>>>>> ----- Original Message ----- >>>>>> From: Crazy Canucks <[EMAIL PROTECTED]> >>>>>> Date: Monday, December 8, 2008 9:50 pm >>>>>> Subject: Re: [hlds_linux] rcon command linux >>>>>> To: Half-Life dedicated Linux server mailing list >>>>>> <hlds_linux@list.valvesoftware.com> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Regrettably, I can't get it to work. This is the command I used: >>>>>>> >>>>>>> su -c "screen -S srcds -X eval 'stuff sm_csay test\015'" cc-server >>>>>>> >>>>>>> Any idea why it isn't working? No error message, and the >>>>>>> screen name is >>>>>>> correct, but when I look at the console, there is nothing there. >>>>>>> >>>>>>> Drek >>>>>>> >>>>>>> David Parker wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Glad it helped. It's really handy to use in cron jobs if >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> you want to automate things on your server. I use it in a >>>>>>> cron job to put our TF2 server into birthday mode every Thursday >>>>>>> (and switch it back to regular mode every Friday). >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> - Dave >>>>>>>> >>>>>>>> ----- Original Message ----- >>>>>>>> From: Crazy Canucks <[EMAIL PROTECTED]> >>>>>>>> Date: Monday, December 8, 2008 7:14 pm >>>>>>>> Subject: Re: [hlds_linux] rcon command linux >>>>>>>> To: Half-Life dedicated Linux server mailing list >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> <hlds_linux@list.valvesoftware.com>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Thanks a lot for this. I've wanted a way for my shut >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> down >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>> script to >>>>>>>>> send shutdown warnings to my server. I figured there >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> had >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>> to be a way, >>>>>>>>> but I couldn't figure it out last time I took a stab at >>>>>>>>> it. :) >>>>>>>>> >>>>>>>>> Cheers, Drek >>>>>>>>> >>>>>>>>> David A. Parker wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> You can send commands to a running screen like so: >>>>>>>>>> >>>>>>>>>> screen -S myscreen -X eval 'stuff stats\015' >>>>>>>>>> >>>>>>>>>> This would send "stats" followed by a return (\r) to the >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> screen named >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> "myscreen". You'll see it on the console if you attach >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> to myscreen >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> afterward. I don't know of a way to capture the output >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> on a screen, though. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> - Dave >>>>>>>>>> >>>>>>>>>> Joseph Laws wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> I imagine that would still be logged. >>>>>>>>>>> >>>>>>>>>>> Marcel wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> Is there a way to store the actual "screen" in a variable >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>> or >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>> text file? >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>>> It would be cool to "send" a command like "stats" to the >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>> screen and get >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>>> the output of it. Where the first "problem" would be to >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>> automatically >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>>> attach to the screen, enter command, detach the screen and >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>> then get the >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>>> content of the screen. This sould be done by a bash script. >>>>>>>>>>>> This way you'd be able to generate nice mrtg graphs about >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>> fps etc. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>>> *without* the rcon password and without logging of the access. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> - Marcel >>>>>>>>>>>> >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> To unsubscribe, edit your list preferences, or view the >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>> list >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>> archives, please visit: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> To unsubscribe, edit your list preferences, or view the >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>> list >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>> archives, please visit: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> To unsubscribe, edit your list preferences, or view the list >>>>>>>>> archives, please visit: >>>>>>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> To unsubscribe, edit your list preferences, or view the list >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> archives, please visit: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> To unsubscribe, edit your list preferences, or view the list >>>>>>> archives, please visit: >>>>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> To unsubscribe, edit your list preferences, or view the list archives, >>>>>> please visit: >>>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> To unsubscribe, edit your list preferences, or view the list archives, >>>>> please visit: >>>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> _______________________________________________ >>> To unsubscribe, edit your list preferences, or view the list archives, >>> please visit: >>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>> >>> >>> >> _______________________________________________ >> To unsubscribe, edit your list preferences, or view the list archives, >> please visit: >> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >> >> > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux