LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2004, 03:59 AM   #1
daenu
LQ Newbie
 
Registered: Nov 2004
Distribution: Slackware, Debian
Posts: 2

Rep: Reputation: 0
Linux programming question


Hi @all

I'm trying to reboot my Linux box with a script (or a C program).
In the script i use the command "reboot -d -f -i" and in my C program i use "system("reboot -d -f -i");".
And the system reboots successful. But unfortunately, the system don't shutdown clean. If i look an my system while executing the scritp (or the C program) it looks like i plug out the power for restarting. That means, that my box don't shutdown as it should be. So it is clear, that my box has several problems if it tries to boot because the harddrive wasn't cleanly unmounted!

If i reboot my box by hand, it works fine.

How can i fix this problem?
Does anyone has a hint for me?

Thanks in advance for your help.

Regards
daenu
 
Old 11-29-2004, 04:40 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
The reboot command just reboots the computer. It shoud normally be called by init (the process responsible for keeping track of daemons), on entering the reboot runlevel (runlevel 6).

The command you want to use to reboot with is thus
Code:
telinit 6
 
Old 11-29-2004, 09:16 PM   #3
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 36
or even shutdown now -i6
 
Old 11-29-2004, 10:36 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Moved: Programming questions go in our, "Programming" forum.
 
Old 11-30-2004, 05:58 AM   #5
daenu
LQ Newbie
 
Registered: Nov 2004
Distribution: Slackware, Debian
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for your replies.
But unfortunately i have still the same behavoir even with your hints :-(

Does anyone have another hint?

Thanks for your help.

Regards
Daniel
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
a little programming question haora Programming 3 06-24-2005 08:19 PM
basic linux programming/compiling question (permissions error) Godsmacker777 Programming 11 03-17-2005 11:35 AM
Basic Linux Programming Question (QT terminal control) Boffy Programming 5 09-09-2004 12:44 PM
Linux Shell programming question ducka Programming 4 09-01-2003 09:24 AM
Programming question pk21 Linux - Newbie 6 12-02-2002 01:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration