firasm / CEST

Analysis of studies
2 stars 0 forks source link

Can we set up a cron job to run sync2pfeifer every 5 minutes while user 'stefan' is logged in? #19

Closed firasm closed 9 years ago

firasm commented 9 years ago

Would be handy to check on status of scans remotely...

DrSAR commented 9 years ago

Not ideal. I worry about it interfering.S

firasm mailto:notifications@github.com 2015 March 23, at 12:23

Would be handy to check on status of scans remotely...

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19.

firasm commented 9 years ago

Interfering with what? Pervasion? or itself

DrSAR commented 9 years ago

yes

firasm mailto:notifications@github.com 2015 March 23, at 12:26

Interfering with what? Paravision?

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19#issuecomment-85157983.

firasm mailto:notifications@github.com 2015 March 23, at 12:23

Would be handy to check on status of scans remotely...

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19.

DrSAR commented 9 years ago

can do intermittently

firasm mailto:notifications@github.com 2015 March 23, at 12:26

Interfering with what? Paravision?

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19#issuecomment-85157983.

firasm mailto:notifications@github.com 2015 March 23, at 12:23

Would be handy to check on status of scans remotely...

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19.

DrSAR commented 9 years ago

ok - it's running, but it would be better if we hooked into the mri directory using a filesystem watcher ...

firasm mailto:notifications@github.com 2015 March 23, at 12:26

Interfering with what? Paravision?

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19#issuecomment-85157983.

firasm mailto:notifications@github.com 2015 March 23, at 12:23

Would be handy to check on status of scans remotely...

— Reply to this email directly or view it on GitHub https://github.com/firasm/analysis/issues/19.

firasm commented 9 years ago

duly noted...

cool ! what's the frequency? 5 mins?

DrSAR commented 9 years ago

This is the shell script:

#!/bin/bash

username=`whoami`
# make sure that user is logged in but not through pvbackup (which is likely the result of the tunnel)
login_check=`who | grep $username |grep -v pvbackup`
logged_in=$?

if [ $logged_in -eq 0 ] ; then
    date >> /home/$username/sync-if-login.log
    /usr/local/bin/syncdata2server >> /home/$username/sync-if-login.log
fi

It runs every 5 minutes because of this cron entry:

*/5 *  *   *     *   bin/sync-if-logged-in.sh >> logincheck.log  2>&1

So this means there is a log file /home/stefan/logincheck.log that should remain empty if the cron job does not throw any errors and a log file for actual transmissions in /home/stefan/sync-if-login.log getting filled every 5 min when someone is logged in.