LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Script to run at Boot for Auto Mysql database check (https://www.linuxquestions.org/questions/linux-server-73/script-to-run-at-boot-for-auto-mysql-database-check-840865/)

Alan87i 10-27-2010 08:37 PM

Script to run at Boot for Auto Mysql database check
 
I'm running zoneminder on Ubuntu 9.10
Even with a UPS the power quite often fails enough that I need to drive over bring home the computer and run
( mysqlcheck --all-databases --auto-repair -p )
Then enter my user PW then my Mysql PW. Both are the same.
How ever if it were possible to create a script that could run at start up I could get anyone to cycle the power and let it fix it's self.

Looking for some help with this as I have not a clue where to start.
Thanks
Allan

feinbein 10-29-2010 05:06 AM

Can you not set up ssh and log yourself in remotely? That way at least you dont have to drive over.
Otherwise have a look into update.rc and startup-scripts.
It is off course a bit risky to write your password in cleartext in the script.

Alan87i 10-29-2010 07:18 AM

I have 2 systems running 9.10 ubuntu. I have ssh and rdp setup . Well I did. after about 2 weeks neither box will let me in. "connection refused" error.
I brought one system home the other day. Both are suppose to be stand alone box's no mouse key board or screen.
Rundown on rdp.
The only way I could get RDP to even work was to set the systems to auto login. And either plug in a powered off screen or stab 3 resistors in the correct holes on the vga port so the system thinks there's a screen attached.

When I booted the one I brought home I had to login. My settings were all still in tact. But none the less I still could not make it auto login or ssh or RDP.
I made a remastered copy of the drive when I first loaded it so I reloaded this 1 system and took it back this time with a screen and keyboard/mouse.
So far after 18 hours I can still login.
The other box is not letting me near it.
So that's my Beef SSH and or RDP is what I hoped for but seems it is not reliable at all.
Thanks for the reply.
Allan

feinbein 10-29-2010 07:47 AM

RDP on linux? You are surely talking about vnc. I would not recommend vnc over wan. You can setup ssh passwordless with authorized keys which is save as long as you keep updated. You can then use a tunnel if you absolutely must have a gui.
It is correct that the vncserver in Ubuntu is in userspace and does only work when you are logged in with a user.
Anyway ssh is a very reliable service and I have a suspicion that your setup is the problem here.
Maybe your WAN has a dynamic ip and you are trying with the old ip? Are you using a firewall? Can you still access your cameras and the zoneminder website? Can you describe your network in detail?

Alan87i 10-29-2010 08:23 AM

I use VNC yes sorry.
The network is not the trouble I'm using PFsense and have total faith in my Nat forwarding. I forgot to mention that while connected to the local network with my laptop SSH still would not work or VNC.
I have both ZM box's configured with Static Leased IP's bound too there MAC address. And yes Zoneminder servers are both accessible over the web.

feinbein 10-30-2010 02:48 AM

I suppose you have issued
Code:

/etc/init.d/networking restart
/etc/init.d/ssh restart

to begin with?
ssh starts in all runlevels?
Local firewall disabled?
You checked the correctness of the IP with ifconfig?
What error do you get when you try and login via ssh?
Another thing, you say you remastered. Maybe a problem with identical hostnames or even mac-addresses?
Just thoughts, I feel I can't really help you more without better detail of your network and setup.
Good luck!

Alan87i 10-30-2010 04:44 AM

AH I did not think to restart the shh service .
When I did I got the host key not found error , After generating a new one ssh worked fine.
I remastered each machine. Both have different host names Mac's and so on.

The other box use to let me in with ssh but just stopped for no known reason.
The error is ( the server unexpectedly closed the connection)
I bet it has the same problem.


All times are GMT -5. The time now is 10:20 PM.