Re: User level service

From: Jameson Graef Rollins <jrollins_at_finestructure.net>
Date: Wed, 11 Sep 2013 09:34:41 -0700

On Wed, Sep 11 2013, Subba Rao <umroute_at_tanucoo.com> wrote:
> I am new to using runit. Long ago I have used djb's daemontools and now
> I have switched to runit.
>
> Now I would like to setup a user level service which uses ssmtp to send
> out reminders. The script looks as follows:
>
> ===============
> #!/bin/sh
> while :
> do
> ssmtp myemail_at_yahoo.com <mailto:myemail_at_yahoo.com> <
> /home/user1/reminders/reminder1.txt
> echo `date`: "Testing email script..." >> ./log.txt
> sleep 5000
> done
> ===============
>
> All this was created as root on my Raspbian. The "log.txt" file has
> entries for each interation but there is no email sent out. If I typed
> in the ssmtp command in a terminal then the email does go out. What am
> I missing here?
>
> I would like to setup this as a user level service. How do I do that?

Hi, Subba. Look at the 'chpst' utility:

       chpst - runs a program with a changed process state

It can be used to run a program with as an arbitrary user or group, with
a specified environment, root, etc., e.g.:

chpst -u user1 ssmtp ...

You should also consider using runit's built in logging facility
(svlogd), rather than writing your own log.

hth.

jamie.



Received on Wed Sep 11 2013 - 16:34:41 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC