LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 06-24-2011, 12:22 AM   #1
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 19

Rep: Reputation: 0
Alternative Ways to Restart Cups Service


Hi All,

I'm trying to find a way to restart the cups service remotely from a windows machine. I've allowed remote admin and can browse to the cups web interface via https://servername:631.

But can't find any option to restart the cups service. Only way I know of is to run "service cups restart" from the server itself (via ssh).

Is there a way to restart cups from the web interface? Or is there another way to restart cups from a windows machine?

I'm trying to avoid having the helpdesk guy (who runs Windows only) ssh'ing into the server to restart the service.

Thanks.
 
Old 06-25-2011, 04:14 AM   #2
kasl33
Member
 
Registered: Oct 2004
Location: Bremerton, WA
Distribution: Arch, Debian, Ubuntu, Ubuntu-Server, CentOS, OSX Lion
Posts: 350

Rep: Reputation: 47
you could install webmin and have him go through that. Or set up a cron job to do it automatically, or set up a php web page that uses $_GET and runs this (apache would have to be a member of lpadmin group though):

<html>
<!-- filename = cups.php -->
<body>
<a href=cups.php?cupsrestart>Restart Cups</a>

<?php
if(isset($_GET['cupsrestart'])){
shell_exec("service cups restart");
}
?>

</body>
</html>
 
Old 06-26-2011, 01:14 AM   #3
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks for the tips kasl_33. Webmin and php web page are probably a little overkill for my needs. Cron job sounds more like what I'll implement.

But I would prefer if I could restart the cups service on a need-to basis. Even better if I could create a short cut for Helpdesk to just click and it would remotely restart the cups service - sort of like windows batch file that restarts a linux service.

I was wondering if such an idea was possible. Thanks.
 
Old 06-26-2011, 04:28 AM   #4
kasl33
Member
 
Registered: Oct 2004
Location: Bremerton, WA
Distribution: Arch, Debian, Ubuntu, Ubuntu-Server, CentOS, OSX Lion
Posts: 350

Rep: Reputation: 47
Quote:
Originally Posted by terencewklau View Post
Thanks for the tips kasl_33. Webmin and php web page are probably a little overkill for my needs. Cron job sounds more like what I'll implement.

But I would prefer if I could restart the cups service on a need-to basis. Even better if I could create a short cut for Helpdesk to just click and it would remotely restart the cups service - sort of like windows batch file that restarts a linux service.

I was wondering if such an idea was possible. Thanks.
well if he's using windows, I suppose a little batch script could work...
 
Old 06-26-2011, 05:01 AM   #5
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 19

Original Poster
Rep: Reputation: 0
How would such a batch script be written? I'm familiar with basic windows batch scripting but not sure how to send a command to a linux box.

Any pointers in the right direction would be greatly appreciated. Thanks.
 
Old 06-26-2011, 03:40 PM   #6
kasl33
Member
 
Registered: Oct 2004
Location: Bremerton, WA
Distribution: Arch, Debian, Ubuntu, Ubuntu-Server, CentOS, OSX Lion
Posts: 350

Rep: Reputation: 47
Well, I can't help you with a batch script. But it is written (as far as I know) just like a shell script in Linux - except you name it with the .bat extension instead of .sh.
 
Old 06-26-2011, 08:23 PM   #7
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks. I know how to write a batch file to restart a windows service on a remote windows server. I'll see if I can tweak it to restart a service on a linux server instead.

Thanks again for your help. Cheers.
 
Old 06-27-2011, 06:19 AM   #8
nooneknowme
Member
 
Registered: Feb 2008
Location: Bangalore, India
Posts: 66

Rep: Reputation: 4
I wonder how you will authenticate to Linux Server via a batch script...The php script posted by kasl_33 looks to me as a better alternative. If you are successful, Do post the script
 
Old 06-27-2011, 05:54 PM   #9
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 19

Original Poster
Rep: Reputation: 0
Use puttygen to generate public and private key pair, then use plink to run the command in a batch script:

plink server -l user -i privatekey.ppk service cups restart

I pipe the command to a log file to check the result. Cheers.
 
Old 08-12-2011, 06:33 AM   #10
salemeni
Member
 
Registered: Aug 2011
Posts: 64

Rep: Reputation: Disabled
Quote:
Originally Posted by terencewklau View Post
Hi All,

I'm trying to find a way to restart the cups service remotely from a windows machine. I've allowed remote admin and can browse to the cups web interface via https://servername:631.

But can't find any option to restart the cups service. Only way I know of is to run "service cups restart" from the server itself (via ssh).

Is there a way to restart cups from the web interface? Or is there another way to restart cups from a windows machine?

I'm trying to avoid having the helpdesk guy (who runs Windows only) ssh'ing into the server to restart the service.

Thanks.
You can write script to check and restart cups.
Cron this script.

generics array

Last edited by salemeni; 12-06-2011 at 02:57 AM.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Alternative ways to turn off write protection my SD card! Advice Pro Linux - Newbie 1 03-29-2011 08:13 PM
LXer: Alternative ways of promoting Linux. LXer Syndicated Linux News 0 01-08-2008 05:30 PM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 11:24 AM
alternative ways of installation? Nightfrost Slackware - Installation 8 10-28-2004 11:04 AM
ways to protect against denial of service attacks. sundarrnathan Linux - Security 1 06-01-2003 12:58 PM


All times are GMT -5. The time now is 06:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration