Solved

shutdown

Posted on 2009-04-06
8
408 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
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
 

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

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…
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 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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

895 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

13 Experts available now in Live!

Get 1:1 Help Now