I just noticed that my helper app isn’t properly unloaded.
A terminal command of “launchctl list |grep com.mothsoftware” gives the result of
[quote]39313 0 com.mothsoftware.mailarchiverx-helper.launchd
0 com.mothsoftware.mailarchiverxpro-helper.76156[/quote]
The first one is the one I need to kill. According to the man page I need to use “launchctl remove com.mothsoftware.mailarchiverx-helper.launchd”. But when I check again with the first command I don’t see a change.
Here is the full plist of the LaunchAgent file:
[quote]{
EnvironmentVariables = {
PATH = “/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/beatrixwillius 1:/usr/local/sbin”;
};
KeepAlive = YES;
Label = “com.mothsoftware.mailarchiverx-helper.launchd”;
ProgramArguments = (
"/Applications/Mail Archiver X/Mail Archiver X.app/Contents/Library/LoginItems/Mail Archiver X .app/Contents/MacOS/Mail Archiver X ",
);
QueueDirectories = ();
RunAtLoad = YES;
WatchPaths = ();
}[/quote]
What am I doing wrong?
High Sierra.
TomE
(TomE)
May 21, 2019, 1:52pm
2
I remember about such an issue in past
Does unload instead of remove work for you?
See e.g. stackoverflow or Apple Communities for details.
perhaps the man pages notes about deprecated and removed functionality helps ?
here it says (on 10.12.6 and I assume its similar on 10.13 and 10.14)
DEPRECATED AND REMOVED FUNCTIONALITY
launchctl no longer has an interactive mode, nor does it accept commands
from stdin. The /etc/launchd.conf file is no longer consulted for subcom-
mands to run during early boot time; this functionality was removed for
security considerations. While it was documented that $HOME/.launchd.conf
would be consulted prior to setting up a user’s session, this functional-
ity was never implemented.
launchd no longer uses Unix domain sockets for communication, so the
LAUNCHD_SOCKET environment variable is no longer relevant and is not set.
launchd no longer loads configuration files from the network
Note NO input from STDIN
Are you getting a non-zero result code after running that command ?
launchctl unload /Users/beatrixwillius\\ 1/Library/LaunchAgents/com.mothsoftware.mailarchiverx-helper.launchd.plist
gives an error
@Norman Palardy: right now I’m using terminal commands. What do you mean with “NO Input from STDIN”?
basically STDIN is the terminal
if you run your command in terminal and follow it with
echo $?
what do you see the echo print ?
thats the result of the last command and if its not 0 then launchctl is not executing your command successfully
For Valentina a
[code]if [ -e /Library/LaunchDaemons/com.paradigmasoft.vserver_x64.plist ] ; then
echo “Trying to stop the current VServer”
sudo -S launchctl unload /Library/LaunchDaemons/com.paradigmasoft.vserver_x64.plist
fi[/code]
works fine. Am I escaping my username wrong? When I execute:
launchctl unload /Users/beatrixwillius\\ 1/Library/LaunchAgents/com.mothsoftware.mailarchiverx-helper.launchd.plist
echo $?
the second line gives a 0.
Mike_D
(Mike D)
May 21, 2019, 2:20pm
7
my code looks like this:
#!/bin/bash
##################################################
# Script to stop and unload Xojo webapps
##################################################
# Settings:
#
# label = unique id in reverse DNS format
# plist = location of the plist file
# Note: don't escape spaces!
##################################################
label=com.mycompany.myapp
plist="/Users/username/Library/LaunchAgents/$label.plist"
echo "##################################################"
echo "# Stopping job (if any) "
echo "# $label"
echo "##################################################"
launchctl stop $label
echo "##################################################"
echo "# Unloading job (if any)"
echo "# $plist"
echo "##################################################"
launchctl unload $plist
echo '##################################################'
echo "$label has been stopped"
echo '##################################################'
@Michael Diehr : thanks, I’ll try your script out. I think the space in my username is the problem.