J
J
jatv02018-04-24 14:59:27
Command line
jatv0, 2018-04-24 14:59:27

How to make console command autorun?

Hello. I want to run pfctl at startup / login, it stopped working through the daemon. (It starts ok manually).
Tell me how to do it right.
Tried:
/Users/username/Library/LaunchAgents/com.test.plist

<?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>com.test.plist/string>
  <key>ProgramArguments</key>
  <array>
    <string>open</string>
        <string>-a</string>
        <string>Terminal</string>
    <string>/Users/username/Desktop/pfctl_autoload.sh</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>
pfctl_autoload.sh:
#!/usr/bin/env bash
sudo pfctl -e -f /etc/pf.conf

sh: launchctl load /Users/username/Library/LaunchAgents/com.test.plist
/Users/username/Library/LaunchAgents/com.test.plist: Invalid property list

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Semchenko, 2018-04-25
@0xcffaedfe

In the sixth line: I missed the "<" in the log because it says a crooked plist <string>com.test.plist/string>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question