Solved

shutdown

Posted on 2009-04-06
8
400 Views
Last Modified: 2012-05-06
can we write any exe/code in linux that run automatically like (autorun file in windows) which can call shutdown of system.

in other words, linux file that call shutdown as soon as cd having code inserted / try to access by user.
0
Comment
Question by:Indarnav
  • 3
  • 3
  • 2
8 Comments
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 200 total points
Comment Utility
to shutdown linux server you can put this code in a shell script

Create a script call shutdown.sh

if you are  running that script as root

just put this line

shutdown -h now

then when you will run that script

./shutdown.sh

it will shutdown automaticaly

if you want to make it automated, you can put this one in Cron tab fiel to make it automated in Certain time ..

0
 

Author Comment

by:Indarnav
Comment Utility
then it will work as autorun ..??
0
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 200 total points
Comment Utility
omm in linux word , autoran mean

you need to run a script in a certain time ..

suppose if you want to shutdown linux server at 5 Pm every day

so create crontab

crontab -e

00 17 * * 1-5 /root/shutdown.sh

then Save crontab file

so that script will run every day at 5 Pm

or you can directly add that command in cron tab

do you want something like this ??
0
 

Author Comment

by:Indarnav
Comment Utility
can i run any exe which can add this to cron tab? and that exe will run as soon as user access cd.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 29

Expert Comment

by:fosiul01
Comment Utility
omm linux does not support exe format .

what are you tryign to do ??

when user will try to access a Cd rom , system will shutdown ??
0
 
LVL 35

Accepted Solution

by:
torimar earned 300 total points
Comment Utility
If what you are looking to do is to create a CD that will automatically run a script once inserted, then this is not possible.

There is no Windows like autorun feature in Linux, because that would be a highly insecure feature. On Windows, malware has been distributed this way.

But even if there were such a feature, your project would most likely fail because of a variety of reasons, but mainly because Linux systems tend to differ from each other:

1. In order for autorun to work, CDs must be mounted first. Not all systems are set to automount.

2. In order for autorun to work on a mounted filesystem, this must be expressly defined to allow execution of executable code. This is not the case by default.

3. Linux is a multi-user architecture with a highly intricate permission system. What would be configured to work for one user need not work for another.

4. On a sidenote, your project would even fail to work on any of my Windows systems, because I tend to disable autorun for being an annoying and insecure feature.
0
 
LVL 35

Expert Comment

by:torimar
Comment Utility
ps:

Some modern Linux distros will automatically play an audio CD or video DVD with the associated player when inserted. But this feature cannot be exploited for your project, because a) it works only for multimedia, not for data CDs/DVDs; b) it has to be configured in the window manager settings - and there are more than half a dozen window managers your possible client could be using.
0
 

Author Comment

by:Indarnav
Comment Utility
thanks for info.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now