I am using Ubuntu 10.04 System. In that, I am trying to wake-up my system automatically at specific time.For that,I wrote a python script for wake-up automatically.The script was run perfectly and I was checked in this location /sys/class/rtc/rtc0/wakealaram.The wake-up time was successfully wrote in this wakealaram file. But the system is not waked-up at specified time. If you have any idea about this problem, let me.It is very useful to me.
Viswa's questions
I am developing project by using python script in Ubuntu 10.04. In my project,I need to reboot the system automatically at particular time period. So that,I was wrote the below command in my python script.
passwd = "my system password"
os.system('echo %(passwd)s | sudo reboot -f' %locals())
It was working fine but today when I run my script it throws the below error.
sudo no tty present and no askpass program specifiedHow to resolve this problem.I need to reboot my system through python script.If you know let me, your answer is very useful to me.
I am using ubuntu 10.04,I need to give execute permission in www folder.But by mistake i gave execute permission in whole var folder.
sudo chmod -R 777 /var
Then i try to change it into normal permission.For that i gavesudo chmod -R 775 /var/
And again i gave execute permission only www folder.But the problem is my index.html file is not run which is located in inside the www folder. How to restore the default permission on the /var directory/folder.
I have to copy the file from my desktop to my mounted directory. I was using the following command to copy the file from my desktop to mounted directory.
os.system("cp -f /home/Desktop/filename /media/folder_1").
It works fine. But the problem is while copying the file from my source to mounted directory(folder_1) if any interruption is happens like network down, then the system continuously keep on trying. It couldn't skip that process. Finally, when the network comes the files are again copy to my mounted directory. Due to this continuous trying, next time i try to move the content it throws "permission denied" error.
How do i copy the file only once, if any network issues happen then it will not keep try to copy, instead of that, it throws the error. If you know, Let me. Its very useful to me.
I have a python script. In that, I am using rsync
for data transfer between two systems. While running, it ask for password for data transfer. So that I create a password-less run by the below command.
ssh-keygen -t dsa
ssh-copy-id -i $HOME/.ssh/id_dsa.pub [email protected]
Now it works fine. While running my python script, the data can be transferred without asking for password. But the problem is that I create a crontab job, and run my script at every reboot, which means every time the system is on, the code will be executed automatically.
In this situation, while reboot, my script starts to execute. But it asked destination system password for data transfer (open one small dialog-box in the name of openssh
).
What to do while reboot the system is not suppose to ask password.
Note: if I am supposed to run my script manually, it could not ask password. The data can be transferred to destination system perfectly.
If you know please teach me .I am waiting.
I am trying to move my file to another system which is located in some other place, with this command:
rsync -avrz src destination
It works fine. But what I need is to put this command in shell script and run it like:
#! /bin/sh
rsync -avrz srcfilelocation destination
When it runs, it asks for the destination system password. I know that password and give it manually.
Now I have decided to assign the password to an environment variable, like pswd="destination system password"
. I need my shell script to read the password from this variable. How can I write a script to do this?
I want to turn my system on automatically every day. So I use the below code in my Python script, but sudo
asks me for a password every time:
os.system('sudo sh -c "echo date \'+%s\' -d \'+ \
24 hours\' > /sys/class/rtc/rtc0/wakealarm"')
How can I run this script without sudo
asking for the password every time?