[ome-users] E-mailing users on the system, Cron jobs and backing up,

josh.moore at gmx.de josh.moore at gmx.de
Tue Aug 11 20:32:08 BST 2009


Hi Alex,

"status" doesn't print out any text if successful. Instead the return
code is significant, making it useful for scripting:

  bin/omero admin status && echo success
  bin/omero admin status || echo failure
  bin/omero admin status && echo yay || echo nay

Sorry for not being clearer.
~Josh.


Alex Sossick writes:
 > Dear Josh
 > 
 > Thanks for the reply,
 > 
 > bin/omero admin status
 > 
 > Does not seem to return anything if the server is running or not,
 > Though I'll use this in my cron job,
 > bin/omero admin status || bin/omero admin start
 > 
 > Alex
 > 
 > josh.moore at gmx.de at josh.moore at gmx.de wrote on 11/8/09 17:17:
 > 
 > > 
 > > Woodbridge, Mark R writes:
 > >>> -----Original Message-----
 > >>> Sent: 11 August 2009 14:51
 > >>> To: ome-users
 > >>> Subject: [ome-users] E-mailing users on the system, Cron jobs and
 > >>> backing up,
 > > 
 > >>> 1/ Is there an easy way of extracting users e-mail addresses from
 > >>> omero to send then an e-mail, (for example to warn about a
 > >>> shutdown or maintenance) I would ideally only wish to e-mail
 > >>> active users, ie people who have used omero in the last month for
 > >>> example. Clearly I can copy and paste out the addresses at the
 > >>> moment, but as more users are added to the system this will ot be
 > >>> practical.
 > >> 
 > >> I run this command (on Linux) which gives a list that I just copy
 > >> and paste into Outlook:
 > >> 
 > >> PGPASSWORD=<dbpassword> psql -h <dbserver> -p <dbport> -U <dbuser>
 > >> -c 'select email from experimenter' <dbname>
 > > 
 > > I added a ticket for this type of functionality, because at the moment
 > > there's nothing like "getActiveUsers()":
 > > 
 > >   https://trac.openmicroscopy.org.uk/omero/ticket/1419
 > > 
 > > The information is stored in that database, so it's just a matter of
 > > exposing it.
 > > 
 > >>> 2/ I was wondering if anyone has a script that could be run as a
 > >>> cron job to make sure the omero server is running, and if its not
 > >>> running start it,
 > >> 
 > >> I have a cron job that runs a short Java program that tries to
 > >> connect to OMERO and sends me an email if it fails. I can send you
 > >> this off-list if it would help. It could be done even more simply
 > >> using bash and python. To actually check whether the server is
 > >> running (regardless of whether it is accepting connections) I guess
 > >> you'll have to use 'ps' or its equivalent on Windows (or perhaps
 > >> some ICE monitoring tool?)
 > > 
 > > There are various ways to do this, depending on what one wants to
 > > guarantee.
 > > 
 > >  bin/omero admin status || bin/omero admin start
 > > 
 > > would do the most basic check and if it does not find the server,
 > > start it. "start" will also run "status" until either 1) the server is
 > > up or 2) 5 minutes pass.
 > > 
 > > "status", however, does not attempt a login which is definitely the
 > > best way of fulling checking the system, and what I tend to use in my
 > > cron jobs.
 > > 
 > >> We host our OMERO database and files on our standard (file)servers
 > >> so do we don't do any OMERO-specific backups, but I have my doubts
 > >> about what happens if a transaction/upload is in progress when the
 > >> backup is made.
 > > 
 > > pg_dump is transactionally safe, but the files on disk may be out of
 > > sync. A filesystem level backup is less safe from the postgres
 > > perspective.
 > > 
 > >> Mark.
 > > 
 > > ~Josh.
 > 
 > -- 
 > Alex Sossick
 > Wellcome Trust/Cancer Research UK Gurdon Institute
 > University of Cambridge
 > Tennis Court Rd
 > Cambridge CB2 1QN
 > UK
 > 
 > email ajs17 at cam.ac.uk
 > tel 01223 334082
 > 



More information about the ome-users mailing list