Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

shutdown

Posted on 2009-04-06
8
Medium Priority
?
417 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 800 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 800 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
Flash Sale! Good things come in big bundles

Save over 50% on our fully managed dedicated server bundle for Labor Day. Plus FREE Guardian Backups, FREE Advanced DDoS Protection and FREE Plesk Onyx Web Pro Edition.

 

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 1200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

#Citrix #POC #XenDesktop #vCenter #VMware #ESX
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 how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

730 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