This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Script shutdown Kalarm after vlc qeue is empty

Tags: None
(comma "," separated)
wotan
Registered Member
Posts
131
Karma
-2
OS
Hello
I am a beginner with linux and KDE as well.
My goal:
Write a script used with kalarm so that when the qeue of vlc is empty the computer will automatically shutdown. Thanks that, once the few episode of how I met your mother I am watching come to an end, I won't need to get up from my bed and manually shutdown the machine ;D
(Therefore i use the Time from now features of kalarm)

Currently i have written this script
Code: Select all
#!/bin/bash
skill vlc
shutdown -P now System is about to shutdown

But as you know better than I do you need to run shutdown with sudo.

Hence my question: What is the tip to get it work?
Is there a way to write a script where I write sudo shutdown then my root password (I mean any trick with echo or this or that, or anytrick that you know)
Shall I rather run kalarm with
Code: Select all
kdesudo kalarm
each time the computer begin ?
In this case how do I change it?
don't forget than I am a complete beginner ;)

Any help is welcome
User avatar
google01103
Manager
Posts
6668
Karma
25
if you set the playlist option "play and exit" then the command vlc && shutdown -h now should work (found here http://wiki.videolan.org/How_to_shut_down_computer) try google'ing http://www.google.com/search?client=ope ... 5&bih=1021


OpenSuse Leap 42.1 x64, Plasma 5.x

wotan
Registered Member
Posts
131
Karma
-2
OS
Hi
first thanks for your help

so I wrote a script ("bye") like this in kate
Code: Select all
#!/bin/bash
command vlc && shutdown -P +1


the thing is since here shutdown is not called with superuser mode it doesn't work (i.e error message here under)
Code: Select all
./bye: line 2:  2308 Segmentation fault      vlc

I can't lauch the whole "bye" script with sudo before since apparently vlc ist not allowed to be run as superuser

Is there really no way to get it with Kalarm?
User avatar
google01103
Manager
Posts
6668
Karma
25
Set up sudoers so that you can run shutdown without a password using the command
Code: Select all
sudo shutdown -P +1

see http://ubuntuforums.org/showthread.php?t=1132821 for explanation of sudo


OpenSuse Leap 42.1 x64, Plasma 5.x



Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], ourcraft