I am using bash and flock on centos.
Normally I would run cd /to/my/dir && python3.6 runcommand.py
But then we add it to cron and don't want output so add > /dev/null 2>&1
And add a flock before it to prevent multiple instances, like so:
flock -n ~/.my.lock cd /to/my/dir && python3.6 runcommand.py > /dev/null 2>&1
Question
Only does this flock the cd /to/my/dir
and then execute the python3.6
(normally without flock) or does it flock the complete row of bash commands (so both) and only unlock when python3.6 runcommand.py
is also finished?
Not clear from the man and examples I found.