Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '2nd method handles Carbon apps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
2nd method handles Carbon apps
Authored by: gatorparrots on Sep 19, '03 12:23:48AM
Normally I prefer to limit ps output by using the u and c flags, thus avoiding the need for the second grep process and another pipe. In this case, however, it seems best to add a bit of inefficiency for the sake of functionality. These functions can now handle Cocoa and Carbon apps by (case-insensitive) name. For example, stop entourage and cont entourage now works.
##------stop/continue processes------##
stop () {
	PID=$(ps axww | grep -i "$1" | grep -v grep | awk '{print $1}');
	mkdir -p /tmp/run;
	echo "$PID" > /tmp/run/"$1".pid;
	kill -STOP $PID;
}
cont () {
	kill -CONT $(cat /tmp/run/"$1".pid);
	rm /tmp/run/"$1".pid;
}
     

[ Reply to This | # ]
2nd method handles Carbon apps
Authored by: bluehz on Sep 19, '03 07:04:26PM

Is it possible to setup an external functions library for sourcing in tcsh shell? I have a few function including the above, that I would like to make available to every shell so I would like it sourced with the inits. Is it even possible in tcsh?

And yes - I know - I should switch to Bash or zsh, BUT since I still consider myself a novice shell scripter and damn near every example (from which I learn) is in sh - I think I will stick with tcsh for a while longer.... hence my request.



[ Reply to This | # ]