Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Modifying Config Files... Dynamically.., will it break?
thaigrrrrl
post May 5 2004, 09:24 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 6
Joined: 4-May 04
From: outside Philly, PA
Member No.: 2,888



I am currently on a project where I have to edit the following files via Perl/ HTML/ Web interface.

resolv.conf
main.cf
transport.cf
ifcfg-eth0
and
network

I was asked to do this, I am not a sysadmin, i'm a Perl programmer.

What will happen if I edit these files while the system is up and running? Will they go into effect immediately?

will I need to restart?

will the whole system crash and crumble beneath my feet?

please tell me your wisdom !

thanks

TG


--------------------
Why is it that both drug addicts and computer afficianados are both called "users"...?
Go to the top of the page
 
+Quote Post
Jim
post May 5 2004, 10:23 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



They wont go into effect untill they are re-loaded. You can either do that be restarting the programs using them, or with a full system restart.

And your system will not crumble benieth your feet unless you typo or screw something up. So here are a few tricks. '
1) Always Copy the file first
cp file file.old
2) Double check before saving
3) Save before editing
4) Double check before saving

You should be fine. The only problem your going to have is since your doing this remotely if you reboot the system and it doesn't boot your screwed. I would recomend restarting each individual process one by one, if it doesn't work you can just replace the file with the one you backed up.
cp file.old file

I don't kno what processes use all of those files, so maybe someone else can help you out with the restart commands, it might not even be possible with out a fool reboot.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
petterg
post May 6 2004, 03:26 AM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 12
Joined: 5-May 04
Member No.: 2,890



If you're changing networksettings remotely you should probably schedule a restore job (cp file.old file && reboot) to start 15 minutes after you restart the network service. In case you screw up the system will restore it self after 15 minutes, and you'll be able to try again. In case you do not screw up you'll have 15 minutes to cancel the scheduled job.
Go to the top of the page
 
+Quote Post
Corey
post May 6 2004, 06:10 AM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 1,254
Joined: 21-September 02
From: St John's, Newfoundland, Canada
Member No.: 3



QUOTE (petterg @ May 6 2004, 05:56 AM)
If you're changing networksettings remotely you should probably schedule a restore job (cp file.old file && reboot) to start 15 minutes after you restart the network service. In case you screw up the system will restore it self after 15 minutes, and you'll be able to try again. In case you do not screw up you'll have 15 minutes to cancel the scheduled job.

That's a great idea, perhaps you would be willing to write out a step-by-step process of this and posting it into our Tips & Tricks forum, i'm sure other people would find this information useful.

Another idea would perhaps be to make a wrapper-script for editing network config files, that would automatically setup this 15 revert unless stopped by the admin. Could save a lot of headaches for people.


--------------------
Corey Quilliam
(former) Linuxhelp.ca Administrator
cquilliam-AT-gmail-dot-com

Want to help out Linuxhelp.net? Check out our Linuxhelp Wiki and see if there are some articles you would like to submit!!

--
Ubuntu 8.04 64-bit - Work Laptop (HP-Compaq NC6400 Core2)
Kubuntu 8.04 64-bit - Desktop (HP m8120n QuadCore)
Ubuntu 6.04 - Server (I'm not upgrading this baby until support runs out in 2012) (Some old POS dell)
Go to the top of the page
 
+Quote Post
hughesjr
post May 6 2004, 07:12 AM
Post #5


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



You would have to restart the services effected .... or restart the computer (which I don't like to do).

looks like network and postfix would need to be the only things restarted ....

Usually, this would require only:

/etc/init.d/network restart

and

/etc/init.d/postfix restart

(unless postfix is being started by another program ... like mailscanner)
---------------------
Like petterg said though, making changes to the network and ifcfg-eth0 remotely is dangerous ... what if the services don't restart?

It might be very good indeed to schedule a program in cron to check the connectivity after restarting the services ... and if it broken, restore the old files and restart the network service.
--------------------
Restarting services (or rebooting the computer) via a web interface itself is pretty tricky ... since the apache user is the user who would run things .... and allowing the apache user to start and stop system services (or reboot the server) is not good.


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
thaigrrrrl
post May 6 2004, 09:40 AM
Post #6


Whats this Lie-nix Thing?
*

Group: Members
Posts: 6
Joined: 4-May 04
From: outside Philly, PA
Member No.: 2,888



Thanks so much guys, I really appreciate the advice. I don't need to worry about the restart remotely.

Get this: the reason why they want this interface is because they are windows network admins trying to administrate a linux box, they don't know the commands to move freely in linux or how to find files.

Since they are going to be installing boxes at their clients, they wanted an easy set up interface dry.gif dumbasses...

:-D but thanks for your help ... linux gurus are the best smile.gif


--------------------
Why is it that both drug addicts and computer afficianados are both called "users"...?
Go to the top of the page
 
+Quote Post
Jim
post May 6 2004, 10:02 AM
Post #7


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Ok, one linux isn't that hard. Two, why are they so afraid of learning a little bit here and there? Whats wrong with people. Some people are so hopelessly dependent on the system (windows) they will fight to protect it. What people need to do is free thier minds (and your computers) and embrace linux.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
Termina
post May 6 2004, 02:01 PM
Post #8


RMS is my Hero
******

Group: Support Specialist
Posts: 862
Joined: 18-February 04
From: Wisconsin
Member No.: 2,404



Ah, Matrix quote. Nifty. XP

If you're intrested, I can show you my PHP code that I use to remote edit/change config files, as well as a script that will allow you to restart services.

I get home in a few hours, I'll be sure to post back them.


--------------------
*Points finger at the author above him* They're a witch! Burn them!
---
Vist my website!
Join me in IRC! Server: st0rage.org Channel: #UnhandledExceptions
Go to the top of the page
 
+Quote Post
hughesjr
post May 6 2004, 06:32 PM
Post #9


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



Termina ... I'm inerested in your scripts!


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
petterg
post May 7 2004, 07:04 AM
Post #10


Whats this Lie-nix Thing?
*

Group: Members
Posts: 12
Joined: 5-May 04
Member No.: 2,890



Webmin is great for remote sysadmin. Think it would work great in your case. Webmin also got a buildt in system to void locking yourself out. (Once I tried to set iptables -P INPUT DROP without opening the port webmin was running on, and it refuesed to apply changes.)

About the cron-script. Basically all it needs to do is:
cp -a /path/to/old/config/file.old /path/to/config
/etc/init.d/service_name restart
Go to the top of the page
 
+Quote Post
Corey
post May 7 2004, 07:20 AM
Post #11


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 1,254
Joined: 21-September 02
From: St John's, Newfoundland, Canada
Member No.: 3



I notice that in my experiences, system admins that were trained at private colleges that use Windows only become very afraid of things they're not used to. With my last job, they told me I couldn't have an email address because of licensing costs, etc. I tried to convince them to move the web server and email server over to a linux server (they were using basic pop3/smtp without exchange) to save on costs, but they wouldn't go for it. Shouldn't it be the job of a systems administrator to seek out information that could lead to a more stable, secure and cost-efficient infrastructure rather then wasting time and money on dealing with licensing costs, constant virus and worm infections, etc.? Maybe I wasn't forcefull enough, maybe I should have gone straight to the VP of Operations and presented some sort of analysis. However, it would have taken a lot of my own time to convince them, and I would not have received anything for it.


--------------------
Corey Quilliam
(former) Linuxhelp.ca Administrator
cquilliam-AT-gmail-dot-com

Want to help out Linuxhelp.net? Check out our Linuxhelp Wiki and see if there are some articles you would like to submit!!

--
Ubuntu 8.04 64-bit - Work Laptop (HP-Compaq NC6400 Core2)
Kubuntu 8.04 64-bit - Desktop (HP m8120n QuadCore)
Ubuntu 6.04 - Server (I'm not upgrading this baby until support runs out in 2012) (Some old POS dell)
Go to the top of the page
 
+Quote Post
hughesjr
post May 7 2004, 07:33 AM
Post #12


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



I agree that webmin is a great remote management tool.

http://webmin.com/download.html


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
hughesjr
post May 7 2004, 07:42 AM
Post #13


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



QUOTE
Shouldn't it be the job of a systems administrator to seek out information that could lead to a more stable, secure and cost-efficient infrastructure rather then wasting time and money on dealing with licensing costs, constant virus and worm infections, etc.?

YES

QUOTE
Maybe I wasn't forcefull enough, maybe I should have gone straight to the VP of Operations and presented some sort of analysis.

Well, it has been my experience that with time at a location, trust from the management is built. So if you are farily new at a job (or in a fairly low admin position), go with what they have and put together plans about what would be best (but go slowly). As your skills are recognized by the management, their belief in your opinion grows. When they (and everyone else in the orginization) realizes that you are the best admin they have ... then you can get all the changes made that you think are right. At least, that has been my experience.


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
thaigrrrrl
post May 7 2004, 11:20 AM
Post #14


Whats this Lie-nix Thing?
*

Group: Members
Posts: 6
Joined: 4-May 04
From: outside Philly, PA
Member No.: 2,888



THanks for the tips, I'm checking out webmin.

I wish I saw this before I wrote everything!!! grr. hehe that's okay I billed extra hours for it happy.gif


--------------------
Why is it that both drug addicts and computer afficianados are both called "users"...?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 15th December 2017 - 10:22 PM