Solved

shutdown

Posted on 2009-04-06
8
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 200 total points
ID: 24076239
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
ID: 24076299
then it will work as autorun ..??
0
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 200 total points
ID: 24076326
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:Indarnav
ID: 24076415
can i run any exe which can add this to cron tab? and that exe will run as soon as user access cd.
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24076434
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
ID: 24076512
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
ID: 24076661
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
ID: 24076756
thanks for info.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 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