LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Some things I'd like my server to do - And can't figure out (https://www.linuxquestions.org/questions/linux-server-73/some-things-id-like-my-server-to-do-and-cant-figure-out-558131/)

Virtuality 05-31-2007 07:22 PM

Some things I'd like my server to do - And can't figure out
 
What I want to do is, starting with the most simple:

1. Make it automatically run 'vncserver' in a terminal so I don't have to do that blindly (or switching monitor over) to start it.
2. Make it automatically log on when starting up.
3. Scheduled (automatic) restarts at the time most suitable, i.e, when no one accesses the website.
9293282. Make it turn itself back on if it shuts down (yea right...)


Other things is, I'm running a site with apache2, php5, mysql5, and anything that requires email validation says it sent, but no one ever recieves the e-mail - how do I set this up to work properly? I'd rather not let people sign up with bogus e-mail addresses.

Also, last night I woke up to find my server off :( Is there ANY log that could tell me why, what happened, or when it turned off?

I don't have the experience to use Debian or anything else than FC6 really.

Coldfire 05-31-2007 10:44 PM

1. When do you want vncserver to run? At startup? If so just add it to your startup scripts. Off the top of my head, I don't recall how set startup scripts in FC, but I am sure Google does.

2. Auto login? You do know that is really insecure, I hope. Here's how:
http://ubuntuguide.org/wiki/Fedora_f...8not_secure.29

3. Do you want the whole machine to shut down, or just certain services? If the machine, why? Linux is pretty stable. I suppose if you pay a lot for power, but...either way, you want a cron (or anacron or whatever) job. Definitely do a 'man cron' and 'man crontab' at a minimum if you aren't familiar with cron. Here are two pages that should help you get started:

http://beau.org/pipermail/whitebox-u...il/006122.html

http://mailman.theapt.org/pipermail/...ly/001931.html

for log messages, check /var/log/messages. That may give you some idea as to why your machine shut down.

Can't help with the email-sorry about that. Setting up email can be a tricky thing-the servers tend to be easy to set up with security holes, so I won't even go there.

You sound like you are new to the Linux world. Welcome! You should note that I found the above links using Google in less than 5 minutes, although I did know what I was looking for. I know sometimes you just don't know what to search for, but I suggest you try web searches first because many folks will simply ignore forum posts that can basically be answered by Google searches, which will greatly annoy you.

wartstew 05-31-2007 11:45 PM

1) Yes there are two ways of running VNC server automatically. Once it logs in as a user, of course you can have it execute as a startup in the user's .bashrc or .profile or something like that (these files are hidden in user's home directory). The system startup scrips alone won't work because vnc requires to be run from a valid logged in user and the system startup scripts run before the user logs in. The second way of running vncserver is to run it "as a service" where once connecting you get a login prompt much like the MS Windows Terminal-server/Remote-desktop system. I've never set it up this way but I think the instructions are on the realvnc website over in the UK. Look for "running vnc from inet.d" or just google it.

2) Yea, this is normally discouraged, but I guess if you have the server locked away in a secure location, it's not so bad. It is just that a lot of people run Linux servers and never seem to see a need for such action. Maybe you trying to do something in an awkward way?

3) This is an even stranger request. Why do you need this? About the only time I need to reboot a Linux server is when I change update a kernel and now with kexec I guess you don't even need to do it then! I suppose if you are running one of those bad-news binary-only kernel modules that has a memory leak or something, you might have to do something like this, but people generally avoid using such hardware like high end 3D video cards or flaky-supported network hardware in Linux servers for this reason.

4) This is a feature of many BIOS of modern computers. You might see if the BIOS in your computer has the ability to auto-restart after an improper system shutdown.

Wim Sturkenboom 06-01-2007 12:21 AM

2) Why do you need an automatic login on a headless (no monitor) system?

3) I suppose that you can run a shutdown -r command from cron

4) Newer BIOSes have the option to restore to the previous power state after a power failure; so if the machine was off, it will stay off after a power failure but if it was on, it will turn itelf on after a power failure

guymatz 06-01-2007 09:36 AM

regarding Q1 about vncserver, i'm not really sure what you want to do, but it seems you want a vncserver to start up on reboot. ? have a look at /etc/rc.d/init.d/vncserver which uses /etc/sysconfig/vncservers as a config file.

in /etc/sysconfig/vncservers you can set up an string of users/ports to start up, as well as an array of configuration options for each of them. for example, if you want user user1 to start a vncserver on port 10 and user2 on port 20, with display options of "-geometry 1176x950 -depth 24" you would have the following:

VNCSERVERS="10:user1 20:user2"

VNCSERVERARGS[10]="-geometry 1176x950 -depth 24"
VNCSERVERARGS[20]="-geometry 1176x950 -depth 24"


hope that helps.

ctbfourone 06-01-2007 10:35 AM

vncserver
 
I would use xinetd to setup vnc on demand, and set it to login using XDMCP.

This is from Linux Server Hacks, but gives you the general idea:

Create the file /etc/xinetd.d/vnc containing:

# default: on
# description: vncserver provides remote desktop connections
#
service vnc
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = :8 -inetd -once -query localhost -depth 24 -geometry 1024x768 -securitytypes=none
}

The server_args line should be one contiguous line. Then in Gnome or KDE enable XDMCP. Then when you try to connect using vncviewer you'll get a graphical login greeter. That's the gist of it, your mileage may vary.

As for automatic reboots and automatic logging in, I don't see any reason why you would want to do either. :scratch:

wayno 06-02-2007 01:52 AM

Quote:

Originally Posted by Virtuality
1. Make it automatically run 'vncserver' in a terminal so I don't have to do that blindly (or switching monitor over) to start it.

Nice and easy in FC6. From a terminal run 'setup'. Go to Services, scroll down to vncserver and select it :) Not forgetting to edit /etc/sysconfig/vncservers as per an earlier post.

brianmcgee 06-11-2007 12:28 PM

1.
Code:

# chkconfig vncserver on
2.
Code:

# cp /etc/inittab /etc/inittab.backup && cat /etc/inittab | sed 's/1:2345:respawn:\/sbin\/mingetty tty1/1:2345:respawn:\/bin\/bash tty1/' > /etc/inittab
I use autologin only for kiosk terminals so that guests may use the station rightaway.

3.
Code:

# crontab -e
then enter this to poweroff at midnight +5 minutes:
Code:

00 00 * * * /sbin/shutdown -h +5
You may power up again by bios wakeup...

But perhaps a energy saving function would be wiser.


All times are GMT -5. The time now is 02:43 PM.