[ome-users] Omero maintenance

Josh Moore josh at glencoesoftware.com
Mon Oct 24 10:50:47 BST 2011


On Oct 24, 2011, at 12:54 AM, Leon Kolchinsky wrote:

> Thanks Josh,
> 
> Redirecting output to /dev/null is not a big deal ;)
> I was talking about more descriptive message (Something like: "Cleanse run
> OK" or something like that) because "Created session
> 0cb6dedf-4653-42b4-911a-d41e492fc6bd" didn't tell me much ;)

:) Agreed, but it's not intended to. The real goal is to have the cleanse command be quiet unless there's an error, similar to mv or cp. But since a "--quiet" will be needed to suppress the "Created session..." anyway, we could have it print out "success" as long as "--quiet" is not set.

> Cheers,
> Leon Kolchinsky

~Josh

> On Fri, Oct 21, 2011 at 18:51, Josh Moore <josh at glencoesoftware.com> wrote:
> 
>> 
>> 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