LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-11-2013, 05:19 AM   #1
AlanSecker
Member
 
Registered: Aug 2003
Location: London, UK
Distribution: Red Hat
Posts: 61

Rep: Reputation: 1
Trying to halt a root process from a desktop icon


I am trying to turn off the mythtv backend,
run kaffeine and then turn it back on again.
Just a three line script.

I assume that this is possible but that I am going about it in my usual A about F fashion.

I have changed the script settings from regular user to root etc but nothing works.

Each line of the script has been tested from a root terminal, so there is something fundamental that I am missing.

Of course I do not want a password request every time it is run either.

Last edited by AlanSecker; 07-11-2013 at 05:21 AM. Reason: missed something
 
Old 07-11-2013, 06:33 AM   #2
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Yes,

the way I see it you need to change line 2 from

Code:

to
Code:

This might solve it
 
Old 07-11-2013, 10:32 AM   #3
AlanSecker
Member
 
Registered: Aug 2003
Location: London, UK
Distribution: Red Hat
Posts: 61

Original Poster
Rep: Reputation: 1
Forgive me but was that meant to represent a serious answer, a time waste, evidence of a psychological disorder or an attempt to introduce disarray into a serious forum?
 
Old 07-11-2013, 10:41 AM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
None of the above.

The intention was for you to see that what you were missing was posting your 3 line script.
So that we might see what the real problem is.

Good Luck.
 
Old 07-11-2013, 10:49 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
In other words: Please post the script in question.
 
Old 07-11-2013, 02:45 PM   #6
AlanSecker
Member
 
Registered: Aug 2003
Location: London, UK
Distribution: Red Hat
Posts: 61

Original Poster
Rep: Reputation: 1
OK but I assumed the principles would remain the same regardless.

Here is the script:

#!/bin/bash
#
# Script: kaffstart
#
# Purpose: Start script to ensure that the MythTV backend is OFF so that
# kaffeine can access the TV tuners and to start kasffeine.
# Also to restore MythTV backend when it terminates.
#

/etc/init.d/mythbackend stop

/usr/bin/kaffeine

/etc/init.d/mythbackend start
 
Old 07-12-2013, 10:39 AM   #7
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by AlanSecker View Post
OK but I assumed the principles would remain the same regardless.

Here is the script:
assuming you have sudo installed

Code:
#!/bin/bash
#
# Script:  kaffstart
#
# Purpose: Start script to ensure that the MythTV  backend is OFF so that 
# kaffeine can access the TV tuners and to start kasffeine.
# Also to restore MythTV backend when it terminates.
#

sudo /etc/init.d/mythbackend stop
  
/usr/bin/kaffeine

sudo /etc/init.d/mythbackend start

and then edit your sudoers file ( important to use visudo )

as root
Code:
visudo
assuming your username is alan, add the 'alan' line
Code:
# User privilege specification
root    ALL=(ALL:ALL) ALL
alan    ALL=(root:root) NOPASSWD: /etc/init.d/mythbackend
via sudo alan will be able to run /etc/init.d/mythbackend as root, without the need for password.

Code:
chown alan:alan /path/to/YourScript.sh
chmod 0700 /path/to/YourScript.sh
and point your desktop link at that script like it was a command.

Last edited by Firerat; 07-12-2013 at 10:42 AM.
 
Old 07-15-2013, 08:27 PM   #8
choronozon
LQ Newbie
 
Registered: Mar 2009
Distribution: Debian lenny & squeeze servers. Mint 13 and 14 desktops
Posts: 16

Rep: Reputation: 2
Talking

Quote:
Originally Posted by Firerat View Post
assuming you have sudo installed

Code:
#!/bin/bash
#
# Script:  kaffstart
#
# Purpose: Start script to ensure that the MythTV  backend is OFF so that 
# kaffeine can access the TV tuners and to start kasffeine.
# Also to restore MythTV backend when it terminates.
#

sudo /etc/init.d/mythbackend stop
  
/usr/bin/kaffeine

sudo /etc/init.d/mythbackend start

and then edit your sudoers file ( important to use visudo )

as root
Code:
visudo
assuming your username is alan, add the 'alan' line
Code:
# User privilege specification
root    ALL=(ALL:ALL) ALL
alan    ALL=(root:root) NOPASSWD: /etc/init.d/mythbackend
via sudo alan will be able to run /etc/init.d/mythbackend as root, without the need for password.

Code:
chown alan:alan /path/to/YourScript.sh
chmod 0700 /path/to/YourScript.sh
and point your desktop link at that script like it was a command.

I wish I'd thought of that before I wrote a C program to su itself to root, and execute my script...
 
Old 07-18-2013, 12:16 PM   #9
AlanSecker
Member
 
Registered: Aug 2003
Location: London, UK
Distribution: Red Hat
Posts: 61

Original Poster
Rep: Reputation: 1
I was delighted to receive that solution and it certainly made sense and taught me something about the sudoers file. I had some other issues to clear up before I could test it but so far it has not worked.
 
Old 07-18-2013, 01:38 PM   #10
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Sorry, this was my fault
in the sudoers file, the last rule wins

you probably have a rule for the group sudo

Code:
%sudo   ALL=(ALL:ALL) ALL
so if you are a member of sudo group, the old rule was 'over written'

put your rule below that ( and any others that would overrule ) , and it should work
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tried to hibernate; wpa_supplicant refused to freeze; process unkillable; cannot halt AlucardZero Linux - Wireless Networking 3 01-11-2019 03:22 PM
to halt a process autophil Linux - General 8 06-16-2009 03:21 AM
running root programs from an desktop icon blastradius Ubuntu 2 11-23-2007 08:50 PM
Root is always busy at halt Archer36 Slackware 2 08-18-2007 05:39 AM
Can't reboot or halt without being root. alex1986 Linux - Newbie 10 12-03-2005 07:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:15 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration