macports-users Digest, Vol 122, Issue 2

James Linder jam at tigger.ws
Mon Oct 3 03:52:54 CEST 2016


>>> Over the years I?ve seen many clever people here, perchance one of them will cast an eye and say THERE . . .
>>> 
>>> I?m trying to run a rc.local at start up
>>> I created a launchdaemon
>>> 
>>> haycorn:jam root# cat /Library/LaunchDaemons/local.startup.plist
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>>> <plist version="1.0">
>>> <dict>
>>>  <key>Label</key>             <string>local.startup</string>
>>>  <key>Disabled</key>          <false/>
>>>  <key>RunAtLoad</key>         <true/>
>>>  <key>KeepAlive</key>         <false/>
>>>  <key>LaunchOnlyOnce</key>    <true/>
>>>  <key>ProgramArguments</key>
>>>    <array>
>>>     	<string>/bin/bash</string>
>>>     	<string>-c</string>
>>>      <string>/etc/rc.local</string>
>>>    </array>
>>> </dict>
>>> </plist>
>>> 
>>> It does not run. Following the launchd.info->troubleshooting www everything does run without complaint. 
>>> (Im creating a ramdisk, but what ever is in rc.local)
>>> haycorn:jam root# ls -l /etc/rc.local
>>> -rwxr-xr-x  1 root  wheel  108  2 Oct 09:58 /etc/rc.local
>>> haycorn:jam root# cat /etc/rc.local
>>> #!/bin/bash
>>> 
>>> DISK_ID=$(hdiutil attach -nomount ram://204800)
>>> diskutil erasevolume HFS+ "ramdisk" ${DISK_ID}
>>> 
>>> I?ve tried specifing <key>Program</key> and 644 permissions on rc.local
>> 
>> [Try again using the righ email.]
>> 
>> I?m no expect, but I don?t think you need the ?-c? parameter.  You already have a reference to a file.
>> 
>> You may also want to add keys to direct stdout and stderr to a file.  Ala:
>> 
>> <key>StandardOutPath</key>
>> <string>/tmp/test.stdout</string>
>> <key>StandardErrorPath</key>
>> <string>/tmp/test.stderr</string>
>> 
>> I think the following web site is pretty good at explaining how to use launchd plists:
>> 
>> http://launchd.info
>> 
>> You can also check ?man launchd.plist? for a reference.
> 
> Craig thanks. I’ve been using the site (http://launchd.info), but it mentions not the -w flag Brandon spoke of.
> The stdout keys don’t help, the launchd works perfectly if you run it (the -c flag: I agree but in desperation I tried).
> My single issue is that *this* launchd does not run at boot time (where stdout is not shown). It runs correctly later and Brandon speculated subsystems are not ready yet so I did this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
>    <key>Label</key>             <string>local.startup</string>
>    <key>Disabled</key>          <false/>
>    <key>RunAtLoad</key>         <true/>
>    <key>LaunchOnlyOnce</key>    <true/>
>    <key>ProgramArguments</key>
>      <array>
>        <string>/etc/rc.local</string>
>      </array>
>    <key>KeepAlive</key>
>    <dict>
>        <key>SuccessfulExit</key>
>        <false/>
>    </dict>
> </dict>
> </plist>

Craig I appologise for being a dork and not reading your mail.
The launchd plist *is* running, just not mounting:

[haycorn] /tmp [507]% cat test.stdout
Started erase on disk2
Unmounting disk
Erasing
Initialized /dev/rdisk2 as a 100 MB case-insensitive HFS Plus volume
Mounting disk
Finished erase on disk2 ramdisk
[haycorn] /tmp [508]% ls /Volumes/
JAMES  MacOSX


[haycorn] /tmp [517]% diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS MacOSX                  999.3 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS JAMES                   2.0 TB     disk1s2
/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            ramdisk                +104.9 MB   disk2

I’ll try, see what I can come up with
Thanks everyone
James



More information about the macports-users mailing list