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.
- application/pgp-signature attachment: stored
Received on Wed Sep 11 2013 - 16:34:41 UTC