Start daemons with screen: rtorrent, irssi

Hello, community!
I run a headless server and, as of now, it boots with rtorrent as a daemon, using screen, like so:
#!/bin/bash
# file: /etc/rc.d/rtorrentd
USER=myusername
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting rtorrent Service"
su $USER -c 'screen -d -m -S rtorrent $USER' &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon rtorrentd
stat_done
fi
stop)
stat_busy "Stopping rtorrent Service"
killall -w -s 2 /usr/bin/rtorrent &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon rtorrentd
stat_done
fi
restart)
$0 stop
sleep 3
$0 start
echo "usage: $0 {start|stop|restart}"
esac
exit 0
The usual, as per our wiki and rtorrent documentation.
I would like to do the same with irssi, but maybe I can't due to not completely understanding this statement:
screen -d -m -S rtorrent $USER
I know the "-d -m" part initializes screen and does not attach to it. "-S rtorrent" names that screen as "rtorrent" (I can check that doing
C-a "
when inside a screen)
But that is as far as I know... I tried using the same script and replacing rtorrent -> irssi, but to no avail, it doesn't start by doing sudo /etc/rc.d/irssid start
I don't need irssi to start at boot, but it would be nice just to
sudo /etc/rc.d/irssid start
and have my IRC setup ready. Any hints? Common mistakes?
Thank you for your time
edit: I also tried to follow irssi's guide but I can't create another screen session. (as in: only rtorrent has its own screen)
Last edited by fhtagn (2011-01-26 05:25:57)

Well, after messing with .screenrc I ended up doing it with a little help from the wiki.
Now, my /etc/rc.d/irssi has:
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
DAEMON=irssi
USER=<username>
PID=$(pidof -o %PPID $DAEMON)
[ -r /etc/conf.d/irssi ] && . /etc/conf.d/irssi
case "$1" in
start)
stat_busy "Starting $DAEMON Service"
[ -z "$PID" ] && su $USER -c 'screen -dm -S '$DAEMON' -c ~/.irssi/.screenrc_irssi' &> /dev/null
if [ $? != 0 ]; then
stat_fail
else
add_daemon $DAEMON
stat_done
fi
stop)
stat_busy "Stopping $DAEMON Service"
[ -n "$PID" ] && kill $PID &>/dev/null
if [ $? != 0 ]; then
stat_fail
else
rm_daemon $DAEMON
stat_done
fi
restart)
$0 stop
sleep 3
$0 start
echo "usage: $0 {start|stop|restart}"
esac
exit 0
and in ~/.irssi/.screenrc_irssi I have
screen -t irssi irssi
And it works!
Is it overkill? Why do I need to have
[ -z "$PID" ] && su $USER -c 'screen -dm -S '$DAEMON' -c ~/.irssi/.screenrc_irssi' &> /dev/null
with '$DAEMON' instead of $DAEMON ? Otherwise it does not work... Probably something to do with bash

Similar Messages

  • My Macbook Pro has a black screen when running in Bootcamp Windows 7. Since I updated the mac side my windows side now starts up with completely black screen - no prompt, nothing, Cap keys still light up as does mouse and DVD drive seems to run.

    My Macbook Pro has a black screen when running in Bootcamp Windows 7. Since I updated the mac side my windows side now starts up with completely black screen - no prompt, nothing, Cap keys still light up as does mouse and DVD drive seems to run.
    Will not show up in safe mode, will not show when started from Windows 7 DVD.
    I suspect the Mac update wiped out my PC video drivers but can not think of a way to re-install?
    Can see the PC volume from Mac side with files.
    I've looked at all the online solutions so far and have tried most of them without success. Please help!
    Specs:
    2009 Macbook Pro, 3.06 GHz Intel 2 core, Max 10.6.8.
      Model Name:          MacBook Pro
      Model Identifier:          MacBookPro5,2
      Processor Name:          Intel Core 2 Duo
      Processor Speed:          3.06 GHz
      Number Of Processors:          1
      Total Number Of Cores:          2
      L2 Cache:          6 MB
      Memory:          4 GB
      Bus Speed:          1.07 GHz
      Boot ROM Version:          MBP52.008E.B05
      SMC Version (system):          1.42f4
      Serial Number (system):          7302300GANE
      Hardware UUID:          B2D4B4B4-CD92-5C7A-BDC2-527D30DD8DF3
      Sudden Motion Sensor:
      State:          Enabled

    EDIT: RESOLVED
    For anyone else who finds their way here like I did, this link did it for me: https://forums.geforce.com/default/topic/527599/windows-8-issues-solved-please-r ead-if-you-39-re-having-black-screen-and-or-flickering-/
    Specifically, the posts by Dunsany and valkyr did the trick.  I booted in safe mode, uninstalled and deleted the Nvidia driver, disabled automatic driver installation, and restarted normally.  I then manually downloaded and installed the previous Nvidia driver for my graphics card (which at the time of this writing was 335.23, rather than the latest which was 337.88), and everything is now bueno!
    Two hiccoughs along the way: First, when I tried to uninstall the Nvidia driver the first time, when I restarted I got the login screen (which was a good sign), but it quickly went black again.  I powered down, restarted in safe mode again, and repeated the uninstallation process, and it worked the second time.  Second, when I started the manual install of the 335.23 driver, the computer played a sound similar to the one for disconnecting a USB device, and the screen went black.  I'd seen a lot about trying to increase the brightness (though it hadn't worked up to this point; but if you haven't tried it yet, might as well); I tried it, and it worked! So far I'm back up and running. [/fingers crossed]
    Hope this helps someone else!

  • IMac G5 running OS 10.4.11. Started playing with a bluetooth speaker (may or may not be related). Now I cannot get past the blue screen on startup. I can get into safe mode. Tried install disc for disc utility and reloaded OS. Still get blue screen.

    I have an older iMac G5 running OS 10.4.11. The other day I started playing with a bluetooth speaker (may or may not be related). Now I cannot get past the blue screen on startup.
    I can get into safe mode. But no regular startup.
    I tried disabling bluetooth, thinking that might be related. It didn't help.
    I even tried using the install disc to run disc utility. That didn't work so I reloaded the OS.
    But I still get hung on the blue screen when trying a normal startup.
    All help would be appreciated.

    Try resetting the PMU/SMU and PRAM/NVRAM. You'd need to identify the mode of resetting depending on the model of your G5 iMac. The Apple support sites that would help you for this are –
    http://support.apple.com/kb/HT1436
    http://support.apple.com/kb/HT1939
    http://support.apple.com/kb/HT1767
    http://support.apple.com/kb/HT1379
    I hope this solves your problem.

  • My imac starts up with a white screen, gray apple and spinning gear and is frozen on that screen. What can I do?

    my imac starts up with a white screen, gray apple and spinning gear and is frozen on that screen. What can I do?

    Start your iMac with the original DVD that camera with the system.  Then open disk utility and repair your hard drive, also repair your permissions. 

  • My Mac mini starts up with a black screen and white writing.

    Okay basically I purchased a Mac mini (Intel Core 2 Duo 1.8GHZ 1GB RAM model) in Feburay 2008, and in June 2008 i decieded to bring it to a store to get it upgraded to 2GB. At the store the guys told me my Mac mini wouldnt accept 2GB, they reckon it was 'cause of the logic board. So they put a new one in and was able to succesfully install 2GB.
    Since that day my Mac mini stopped starting up with the apple logo. Now it starts up with the white/greyish background without the apple logo, then goes to a black screen and just runs pass loads of white text then its ready to use with no problems. It does this all the time.
    I've read a little about the Kernal Panic and looked at pictures of it, but what I have doesn't look like the kernal panic pictures i'm seeing.
    So i am writing this pose to find out whats wrong with my Mac mini, can anyone help me?
    Oh, I nearly forgot. When i turn the Mac mini off it does the same black screen with white text stuff before fully shutting down.

    Restart the computer with the Option, Command, P, and R keys held down, and release them when you hear the second startup chime; this clears a setting which causes it to start up into verbose mode each time.
    (35613)

  • I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works with iPod not with iPhone

    I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works with iPod not with iPhone

    Try posting in the developer forums to see if you can get some assistance,you'll have to be a registered developer for access though.
    developer.apple.com

  • On start up my Mac Book Pro shows a white screen with a spinning wheel. I have tried starting up with the Snow Leopard disk - all I get is a blue screen. I guess that this is a major repair job??????

    On start up my Mac Book Pro shows a white screen with a spinning wheel. I have tried starting up with the Snow Leopard disk - all I get is a blue screen. I guess that this is a major repair job??????

    If you have the exact same problem - take the computer to an Apple store or an AASP.  Whichever is more convenient for you.  If you have AppleCare call them!

  • HT202159 Problem with Update on   It started, then the screen went white and the icons for the apps on the desktop were all blackened, 'waiting'.  What now?

    It showed a number of apps to be updated on my iPad, so I clicked 'update all' as usual.  It started, then the screen went white.  The icons for the apps on the desktop went black, as they do, with the first one half way around the little circle timer, and two marked 'waiting', with others not that far into the process.  They all stopped.  Now I can't stop the update process in the App Store, or use any of the apps.  What do I do next?  Help, please!

    Hello there, Rev Susi.
    From what I can gather you have a few apps that only display "Waiting". The following is a past discussion that dealt with a similar issue, the answer may help you as well:
    App updates won't download on my...: Apple Support Communities
    https://discussions.apple.com/thread/4111336
    Try tapping the App, so that it changes to Paused instead of Waiting, then tap it again to resume the install.
    Make sure you don't have any paused downloads in other apps either, like the App Store or iTunes Store.
    If that doesn't do it, try resetting or restoring the iPhone.
    via whatheck
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • IMac 24' starts up with Pixelated screen and hangs.

    Lately ive been facing problems with my iMac (2009 early model, 3.06 Ghz Intel Core 2 Duo, 4Gb DDR3 RAM). Mostly its during start up. iMac has pixelated screen and the loading wheel also hangs and sometimes the screen also starts blinking. I need to long hold the startup button at the back to reboot, which sometimes works in one reboot and sometimes it takes 3,4 or may be more. Also after starting up, the pop up shows, that computer was not shut down properly. After starting up, iMac has started freexing and pixels start appearing and screen freezes (scheck creenshot below), but I've noticed that even after freezing, I've had the internet on my phone working perfectly fine, which runs via the iMac's wifi sharing.
    Can someone please help me solve this issue. The motherboard has been recently replaced due to other problems i was having. What could be causing the start problems ? IS my hard drive crashing or what?
    Plese help.

    That looks more like a problem with the GPU. You should run the Apple Hardware Test http://support.apple.com/kb/PH11342

  • Hey ppl,my macbook is not booting and by that i mean u can hear the audio wave when its starting up,the screen goes white and then after a while there's a folder with a question mark in the middle of the screen...anyone,any ideea?!?

    Hey ppl,my macbook is not booting and by that i mean u can hear the audio wave when its starting up,the screen goes white and then after a while there's a folder with a question mark in the middle of the screen...anyone,any ideea?!?Regards.

    That folder with the question mark icon means that the MacBook can't find the boot directory. That can either mean it can't find the hard drive or the hard drive data is somehow corrupted.
    Put your install DVD into the drive and reboot. As soon as you hear the boot chime, hold down the "c" key on your keyboard (or the Option key until the Install Disk shows up). That will force your MacBook to boot from the optical drive.
    Once it has finished booting and you are at the Install screen launch Disk Utility from the Utilities menu. Is your Hard Drive in the list on the left?
    If it is then select the First Aid Tab run Repair Disk and if that repairs any problems run it again until the green OK appears and then run Repair Permissions.
    If your hard drive isn’t recognized in Disk Utility then your hard drive is probably dead.

  • My screen has gone blank on startup and occasionally a grey folder with a question mark appears. I have tried rebooting either by pressing the start up with power or pram.. Neither attempts have worked ! My iMac is 2008. Please help :)

    My screen has gone blank on startup and occasionally a grey folder with a question mark appears. I have tried rebooting either by pressing the start up with power or pram.. Neither attempts have worked ! My iMac is 2008. Please help :)

    Hey Carolinearnold!
    I have an article for you that seems to address this issue and can provide some troubleshooting steps for you:
    Mac OS X: Gray screen appears during startup
    http://support.apple.com/kb/ts2570
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • I have a 2007 Macbookpro and it started up with gray checkered boxes ann across the screen I tried to re load OSX and it work 1 day and started again is this a hard drive problem or Video?  Now as it starts to load a screen comes up saying to restart

    I have a 2007 Macbookpro and it started up with gray checkered boxes and across the screen I tried to re load OSX and it work 1 day and started again is this a hard drive problem or Video?  Now as it starts to load a screen comes up saying to restart over and over again

    I'd suspect this known issue:
    http://support.apple.com/kb/TS2377
    if you have a late 2007 MBP.
    The only testing you can do at home is to attach an external monitor and see if the defects repeat on the external. If so, get to an Apple store. If the computer's video chipset fails a test the Apple Store will perform, you get a free logic board replacement. Turnaround is usually one day to one week--not bad at all.
    If the defects do NOT repeat on an external monitor, then the problem is not covered by the above Repair Extension Program
    The issue is heat-triggered. Be certain that you control heat once you get it fixed. Don't use the computer in your lap without a lapboard; don't block the vents under the display hinge; don't us in clamshell mode, etc.

  • How do I get started with screen sharing?

    There are dozens of articles on the web and posts here talking about what's new with screen sharing in Lion, but for the life of me I can't find anything that tells somebody completely new to screen sharing how to get started.  If I want to do screen sharing with a friend (over the Internet, not a LAN), what exactly do we have to do to get started?
    Sorry for a noob question, but everything I see assumes you're already completely familiar with it and just want to see Lion tweaks.

    ok so go to your system preferences on your MAC > go to sharing > click the screen sharing option on> next go to the add users section right below on the right and you add your friend whom you want to share with. You have to select a password for this person.  When you get this done you will see a
    Other users can access your computer's screen at:
    and you will have an address there with some numbers. give this to your friend whom you want to see your screen, they have to post this in their web-browser, and that is how you remotely screen share. This is if you all are not on the same network. Also if you want to share his/her screen they will have to do these steps for you.

  • How I can unlock an encryption on my macbook pro ? device is not starting only with sos sound & black screen I don't know what should do ?

    how I can unlock an encryption on my macbook pro ? device is not starting only with sos sound &amp; black screen I don't know what should do ?

    You have to take the computer to the Apple store.
    http://support.apple.com/kb/HT4790
    Best.

  • Trying reinstall OSX but screen starts up with circle with hash "no sign"

    trying reinstall OSX but screen starts up with circle with hash "no sign"

    What shows as boot choices if you hold the Option or alt key down at bootup?

Maybe you are looking for

  • I am having a problem reinstalling osx.

    I am having a problem reinstalling osx. Disk utility reports the following disk errors: 1. Unused node is not erased. 2. Volume bitmap needs monor repair for orphaned blocks I have tried verifying and repairing disks and get message that it cannot be

  • Moving iPhoto Library - not sure I did it correctly

    Hi - I just recently needed to move my iPhoto (08, 10.5.8) library to an external drive due to it's large size.  To to this, I navigated to the iPhoto Library folder, and then selected the iPhoto Library icon within that folder and moved that object

  • Photoshop CS6 still running in Background Processes, won't close

    Lately, I've been having a problem with Photoshop CS6 where, even after I close the program, Photoshop.exe is still running under Background Processes in the task manager. Hitting "end task" on the program doesn't do anything. It takes up quite a big

  • LMS & Captivate 4 Quiz...Exit problem

    Hi, We are using Captivate 4. We are uploading Quiz slides into JoomlLMS. The SCORM is working fine. The records are updated in gradebook. The challenge: How do we exit after completing the quiz. If we close the quiz window, we end up closing the LMS

  • Caido-dock-plugins won't install

    Here's yaourt log: $ yaourt -S cairo-dock-plugins ==> Downloading cairo-dock-plugins PKGBUILD from AUR... x PKGBUILD Comment by: pivonroll on Fri, 28 May 2010 10:34:59 +0000 There is an error in PKGBUILD. Instead of: $srcdir/$_pkgname-$pkgver-$subver