hi in this simple script I call a function usage() if there is a cron job owned by root. Is it possible to do an else statement within the awk, so when the condition is not met I call another function? Can you please provide an example? Thx
usage ()
{
# Print usage
echo "usage function"
}
#
export -f usage
ps -ef | awk '{if ($0 ~ /crond/ && $1 == "root") {system("/usr/bin/env bash -c usage")
awkscript NOT ONLY calls a function IF there is a cron job owned by root -- The usage function is called FOR every running root process having the stringcrondin any part of its command line (a root process asecho crondwill cause to call the function usage)