[ome-users] Omero maintenance

Josh Moore josh at glencoesoftware.com
Fri Oct 21 08:51:03 BST 2011


On Oct 21, 2011, at 1:42 AM, Leon Kolchinsky wrote:

> Hello All,
> 
> I have a quick question regarding Omero maintenance:
> 
> I'm running the following script every hour:
> 
> # cat /srv/scripts/cleanse_omero_repo.sh
> #!/bin/bash
> 
> USERNAME="root"
> PASSWORD="verysecret"
> BINARY_REPOSITORY="/srv/omerodata"
> OMERO_HOME=/srv/omeroserver
> /bin/su - omero -c "$OMERO_HOME/bin/omero -s localhost -u $USERNAME -w
> $PASSWORD admin cleanse $BINARY_REPOSITORY"
> 
> The output usually is something like that:
> Created session 0cb6dedf-4653-42b4-911a-d41e492fc6bd (root at localhost:4064).
> Idle timeout: 10.0 min. Current group: system
> 
> Is it OK?
> What does it mean?

It's definitely ok. It's just the command-line's reporting on who you are logged in as. 

> Any way to make it more "user friendly" in the future versions?

A "quiet" option is already in the works for the command-line, which will be available in 4.4. For the moment, you can either use a Python script rather than bash script to do the same thing, or you capture the error output with something like this:

    ERROR=$(./err.sh 3>&1 1>&2 2>&3);

For example:

    ## Run without an error
    /tmp $ ./swap.sh 
    out:Fri Oct 21 09:40:36 CEST 2011

    ## Run with an error
    /tmp $ ./swap.sh 1
    out:Fri Oct 21 09:40:37 CEST 2011
    ERROR:
    err:Fri Oct 21 09:40:37 CEST 2011

    /tmp $ cat swap.sh 
    #!/bin/bash

    ERROR=$(./err.sh "$@" 3>&1 1>&2 2>&3);

    if [ $? -ne 0 ]
    then
        echo "ERROR:"
        echo "$ERROR"
    fi

    /tmp $ cat err.sh 
    (echo -n "err:"; date) 1>&2
    (echo -n "out:"; date)
    exit $1


So something like:

    ERROR=$(/bin/su - omero -c "$OMERO_HOME/bin/omero -s localhost -u $USERNAME -w $PASSWORD admin cleanse $BINARY_REPOSITORY" 3>&1 1>&2 2>&3);
    if [ $? -ne 0 ]
    then
        echo "ERROR:"
        echo "$ERROR"
    fi


> Cheers,
> Leon Kolchinsky

Cheers,
~Josh.




More information about the ome-users mailing list