Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: FreakWent on January 29, 2011, 01:58:40 PM

Title: db configuration set squid enabled... Broke my system?
Post by: FreakWent on January 29, 2011, 01:58:40 PM
Look here at what I did and what happened:

bash-3.00# /sbin/e-smith/db configuration show squid 
    EnforceSafePorts=no
    SafePorts=21,70,80,81,119,210,443,563,980,1024-65535
    TCPPort=3128
    TCPProxyPort=80:3128
    Transparent=no
    TransparentPort=3128
    access=private
    status=disabled

bash-3.00# /sbin/e-smith/db configuration set squid enabled

bash-3.00# /sbin/e-smith/db configuration show squid
squid=enabled

How do I get squid's config back in the config db?
Title: Re: db configuration set squid enabled... Broke my system?
Post by: Jáder on January 29, 2011, 03:23:58 PM
the correct command should be:
Code: [Select]
/sbin/e-smith/db configuration set squid status enabled
note you missed the word status in your command!

I'm not sure how to go back... maybe
Code: [Select]
/sbin/e-smith/db configuration delprop squid
followed by a "signal-event post-upgrade" and "signal-event restart" so template are rebuilt.

anyone can confirm this BEFORE FreakWent test it ?

EDIT: FreakWent: because you have all information requested to go back to previous state, you can issue a long db command with all those parameters... or use one each time.
Code: [Select]
/sbin/e-smith/db configuration setprop squid
    EnforceSafePorts  no
    SafePorts 21,70,80,81,119,210,443,563,980,1024-65535
    TCPPort 3128
    TCPProxyPort 80:3128
    Transparent no
    TransparentPort 3128
    access private
    status enabled
Title: Re: db configuration set squid enabled... Broke my system?
Post by: CharlieBrady on January 29, 2011, 05:23:29 PM
How do I get squid's config back in the config db?

You can get the default configuration back by doing:

/sbin/e-smith/config delete squid
/sbin/e-smith/signal-event post-upgrade
/sbin/e-smith/signal-event reboot

Title: Re: db configuration set squid enabled... Broke my system?
Post by: CharlieBrady on January 29, 2011, 05:24:26 PM
the correct command should be:
Code: [Select]
/sbin/e-smith/db configuration set squid status enabled

No, that's not correct. The correct command would have been:

/sbin/e-smith/db configuration setprop squid status enabled
Title: Re: db configuration set squid enabled... Broke my system?
Post by: CharlieBrady on January 29, 2011, 05:27:12 PM
I'm not sure how to go back... maybe
Code: [Select]
/sbin/e-smith/db configuration delprop squid
followed by a "signal-event post-upgrade" and "signal-event restart" so template are rebuilt.

anyone can confirm this BEFORE FreakWent test it ?

You would use 'delete' rather than 'delprop' to delete the whole record.
Title: Re: db configuration set squid enabled... Broke my system?
Post by: CharlieBrady on January 29, 2011, 05:33:07 PM
EDIT: FreakWent: because you have all information requested to go back to previous state, you can issue a long db command with all those parameters... or use one each time.
Code: [Select]
/sbin/e-smith/db configuration setprop squid
    EnforceSafePorts  no
    SafePorts 21,70,80,81,119,210,443,563,980,1024-65535
    TCPPort 3128
    TCPProxyPort 80:3128
    Transparent no
    TransparentPort 3128
    access private
    status enabled

No, this is close, but won't work, because the type of the record (currently 'enabled') must be set to 'service'. So you would need:

Code: [Select]
/sbin/e-smith/config set squid service \
    EnforceSafePorts  no \
    SafePorts 21,70,80,81,119,210,443,563,980,1024-65535 \
    TCPPort 3128 \
    TCPProxyPort 80:3128 \
    Transparent no \
    TransparentPort 3128 \
    access private \
    status enabled
Title: Re: db configuration set squid enabled... Broke my system?
Post by: Jáder on January 29, 2011, 06:01:40 PM
So in general my tip was correct but the sintax was wrong. Good to know.

I'd love to use this opportunity to understand and later document differences between set setprop del delprop get getprop show ...

In the http://wiki.contribs.org/Db_command_tutorial this is not clear and I have problems to understand where/when to use each one. Wouldn't be nice to make a lemonade with this lemon ? ;)

Title: Re: db configuration set squid enabled... Broke my system?
Post by: cactus on January 29, 2011, 06:12:20 PM
I'd love to use this opportunity to understand and later document differences between set setprop del delprop get getprop show ...
It all seems pretty straight forward and I am unsure if this really needs additional documentation. The internal configuration database is described in detail in the SME Server Developers Guide which can be found in the wiki.

In principle every database has a key of a certain type, with zero or more properties. To delete a whole key one would use:
Code: [Select]
db database delete keyTo delete a property one would select the key from the database which is the parent of the property and select which property of that key to delete:
Code: [Select]
db database delprop key property
To set values the same analogy applies, specify the database and the key and state the propery and the value you would like to set:
Code: [Select]
db database setprop key property value
Title: Re: db configuration set squid enabled... Broke my system?
Post by: FreakWent on January 29, 2011, 10:10:08 PM
Wow, great replies everyone, thanks a lot!

I won't do a signal-event post-upgrade because I suspect that this will alter values other than squid, and I have some other changes in the db too.

I have enough here to fix this, so thanks again!
Title: Re: db configuration set squid enabled... Broke my system?
Post by: cactus on January 29, 2011, 10:19:37 PM
I won't do a signal-event post-upgrade because I suspect that this will alter values other than squid, and I have some other changes in the db too.
Normally it should not. It will only effectuate the changes made in the configuration database(s). Eventually you will have to do a signal-event post-upgrade after installing updates. It is better not to wait with this after updates in order to keep the system functioning stable and properly.

Other configuration changes through server manager might lead to undesired effects as well, if you fail to do the signal-event post-upgrade when required.