Re: Service to run user-owned init scripts at boot time?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pds wrote:
> On Fri, 30 Jan 2009 06:18:20 +0100
> Kevin Kofler <kevin.kofler@xxxxxxxxx> wrote:
> 
>> This should work:
>>
>> cat >>/etc/rc.d/rc.local <<EOF
>> for i in /home/*/.rc.local ; do
>>   user=${i#/home/}
>>   user=${user%/.rc.local}
>>   su $user -c $i
>> done
>> EOF
>>
>>         Kevin Kofler
>>
> 
> This should work as long as all the prerequisite services have been
> started, such as mounting the file system.
> 
Considering when rc.local runs, all the other services should have
been run. From the rc.local file itself:

# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

> One other requirement is all users accounts are in /home.

You could try something like this (untested):

RClocal=".rc.local"

USERS=`awk -F: '{print $1}' /etc/passwd`
for i in $USERS
  do
   HOME=`grep \^$i: /etc/passwd | awk -F: '{print $6}'`
   if [ -r $HOME/$RClocal ]; then
     su $USER -c $HOME/$RClocal &
   fi
  done

You could fancy it up a bit by only using UIDs 500 or greater,
depending on what you want.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux