Linux Help with shell-script

krishnandu

Level F
Hi, I'm trying to achieve this in Ubuntu Lucid.

I wanted to suspend my pc from shell script. So wrote a shell script..

Code:
#!/bin/bash

pm-suspend
Now I want it to run without asking for password, so I chmod it as root : sudo chmod 777 filename.sh

Till now it was fine.

Now I can't find any other way to wake-up without pressing the power button. If I'm missing something please help me out here.

I want my pc to wake-up using command(I don't know what command for wake up), that I'll sending though serial-port.

So is this possible?? And if yes, then how??

I've some more query though...(sorry, didn't googled / researched about these)

1. I've disabled GUI login(auto-login :P), so I'm placed with CLI login, how can I login there automatically?? (Without typing username/password)

2. How to run a script automatically on login??
 
Sanjeet Arora said:
What exactly are you trying to do!

A device will be connected to serial port, and to save power on pc(as it'll run on battery), it'll be suspended, now on any reason it would be waked up from sleep mode, so I'll be sending the command to wake up from the device that's connected with serial port. As there will be a script running in background which will always monitor any data from serial port.

You can add that script in the startup applications. That will make it run at each login.
How?? I don't have GUI, can you assist me how to do it from CLI??

--- Updated Post - Automerged ---

Gaurish said:
See this on how to wakeup your PC

ACPI Wakeup - MythTV
Thanks buddy :)
 
Well...I did the autologin part. A little google search revealed that :) Thanks for the help though :)

@ujjwai If I put it on ~/.bashrc it'll be called for that particular user. I'm trying to do it system wide(for all users).

BTW this looks nice http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/

Another thing, I want to read/write on serial port. Please don't redirect me to use minicom. I want some simple shell script.

Will this thing work??

echo "hi" > /dev/ttyS0 : To write on serial port.

echo < /dev/ttyS0 : To read from serial port.
 
Back
Top