General :: Execute A Python Script In Regular Time Intervals?
Jan 14, 2010I am trying to find a way to execute a python script in regular time intervals? How can I do it?
View 2 RepliesI am trying to find a way to execute a python script in regular time intervals? How can I do it?
View 2 RepliesI'm doing some research into ip roaming and haven't come across a whole lot. My definition of IP roaming is the client / server changing of IP addresses on a regular basis using a pre-set number of IP addresses that both client and server have knowledge of. Specifically I'm interested in if anyone knows of any Linux applications that allow for IP address changing on regular intervals.
View 3 Replies View RelatedI'd like to set up a shell script that will send various emails at regular intervals through gmail. I'm sure that there is some sort of text-based email client out there, but I'd like to do this with cron or anacron. I know a little bit of shell scripting but am definitely not great at it.
View 2 Replies View Relatedusin a command which will allow me to evaluate the performance. What i would also like to do is compare the performance over 30 minute intervals. I am thinking i can use the ps -aux command but not sure on how i would specify the time intervals. Is there another way? I really want to see the CPU, disk usuage and memory.
View 9 Replies View RelatedI am currently running debian lenny on an old mini ITX box (1GHZ 1GB ram OS on a 16GB CF card, 4 X 1TB sata drives) as a file server on my home network. I have modified /etc/inittab to auto log in a standard user, start X and start fluxbox. I would like the system to then start a couple of VM's using virtual Box but as this is not a high spec box I would like to start these automatically at 5 min intervals and about 5 min after the auto log in.
Does anyone have any suggestions on how i can achieve this or alternativley monitor the processor load and start each VM in sequence as the porcessor load drops below 20%.
i cant use regular expression in replace function. I want to do this
a = ' Bad boy'
b = a.replace("b[aA]d", '')
Ofcourse this is a simple example for my query. Its not working so shall i assume regex dont work with replace function ?
I have made this:
Code:
from urllib import urlopen import re
current_site = urlopen("http://www.krak.dk/").read()
search = re.findall("((http://|https://|ftp://)|(www.))+(([a-zA-Z0-9.-]+.[a-zA-Z]{2,4})|([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}))(/[a-zA-Z0-9%:/-_?.'~]*)?", current_site)
[code]....
I only want to match complete URL's. how do i avoid matching the fragments ?
I have this regular expression
Code:
(@description ").*(";)
I want to match anything in between the quotes its working fine in JavaScript but its not working in my python program:
Code:
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import re
[code]....
Create a file. change its permissions at a specific time. change the permission.
At the moment this is what I have and it changes the permissions of the file but not according to the time specified.
I am trying to scan a website for http references (links) with this script:
Code:
from urllib import urlopen
import re
current_site = urlopen("http://en.wikipedia.org/wiki/").read()
search = re.search('href="[a-zA-Z0-9]"', current_site)
[code]....
I get the following error message:
Code: Traceback (most recent call last): File "C:UsersadminDesktopcrawler.py", line 8, in <mo print search.group(0) AttributeError: 'NoneType' object has no attribute 'group' I have googled the error
Quote:
#!/bin/ksh
DBcounttry_finalnofunc()
{
[code]....
I installed a newer version of python in /usr/local/bin/python2.6. Now I want to use that python and only that one. When I type "Which python", I want to see /usr/local/bin/python2.6, NOT /usr/bin/python, which is old one (2.4). Also, I want to see the same even after I reboot. How do I do that?
View 2 Replies View RelatedI need a script that executes a command based on a folder's last modified time.
if "/var/data" was modified in less than an hour then "/usr/local/etc/searchd stop" should be run
can we use "find -mmin +60 -type d" in conjunction with second command
I have written a backup script backing up the data I have worked during the day with rsync and sends me a log in my email. now it works perfect but i want to execute it each time i shutdown my computer in the evening not during reboot or logout.It seems that i can not run it by putting it in init.d and softlinking in rc0.d as K00backup. I think it is because script uses many services like python or smtplib, gnome-keyrings that in that time might have been already shutdown.
View 2 Replies View RelatedI am using this cool gnome applet for desktop wallpaper management.
[URL]
but needs following input on this one
how can i create a simple right click menu entry on desktop so that i can rotate wall papers by clicking on that entry.
I am using GNOME and nautilus.
even a wall paper rotation shortcut key might help me at this movement,
at this point the only option i find is through right click on the icon placed in panel and then selecting next photo.
I have some bash and python scripts. Is there any way to encrypt them but still be able to execute them encrypted?
View 7 Replies View RelatedI wonder if it's possible to have cron run xmessage or gxmessage at certain intervals?
View 7 Replies View Relatedis there any way to execute a command every time a "folder changes status"? Under windows there's an API which pro-actively tells you when something has changed within a directory, so I was trying to achieve something similar under Linux. I can't think anything else other than check the list of files and parameters (e.g. date/size/owner) every few seconds, but that's not ideal of course... So what I'm asking here is: is there is a way to set linux to tell me rather than me go and check?
View 2 Replies View RelatedI need to write a program for time. like i have 2 tasks both minutes and hours.
like this
1st task=5 hours and 30 minutes
2nd task=2hours and 45 minutes
Together they will take 8 hours and 15 minutes.
I need to write a program thats called ADDTIMES to do something like this.
This is what i have so far.
H1=int(input("enter the number of hours:")) etc..
I'm doing a program and I want it to execute some code during n seconds. For example e put a command in the shell like this 'ls % 10' and the program should run the command ls for 10 seconds.I'm trying something like this:
Code:
pid = fork();
if(pid == 0) {
[code]....
I am running Centos 5.3. I ran no updates, performed no installs, nor changed any configuration immediately prior to this issue. My problem is this: when I run the command startx (default runlevel 3), it is a long time (5-10 minutes) before Gnome startx, and once it does start applications will not run. Also, when I try to use sudo (from any environment, even ssh), it is a long time (5-10) before the command is executed.
I cannot say for sure, but it seems like this is an intermittent problem. Sometimes X takes a long time to start, but once it starts it will launch programs. Sometimes X takes a long time to launch, but once it starts it will only launch certain programs. Though presently X always takes a long time to start, and I cannot successfully launch any programs.
A while back a had a similar problem to this (x taking long time to start, sudo taking long time to execute) and it ended up being a DNS problem. Unfortunately, I cannot remember exactly what it was and I stupidly did not document it. Maybe this is also DNS related, I don't know.
I don't know what log files to look at for problems with X, Gnome, and sudo taking a long time to start.
in ubuntu 10.10, I have installed python 2.7. I would like to use apt-get to install packages to this version of python but I haven't been able to figure out howThings I have tried without success:changing the symlink at /usr/bin/python to point to /usr/bin/python2.7 - even after doing this apt-get still installs stuff to python2.6.Set up python2.7 as the primary alternative using update-alternatives - doesn't work
View 3 Replies View Relatedway to hibernate at a specific time or after a some minutes (like 40 minutes to an hour, guess the exact time doesnt matter anyway). normally i shutdown my comp at night with
Code:
sudo shutdown - P HH:MM
which works just fine, but sometimes i have like 4 workspaces of stuff open that i'm working on so i'd rather just hibernate. shutdown -H does this halt thing that is really not my cup of tea so from the aformentioned googling i found out about at and sleep and crontab etc. but at and sleep cant recieve my sudo password beforehand so its useless and crontab is for repetitive scheduling, which i'd like to avoid cause i would hate to be working and suddenly have my forgotten crontab script hibernate me.
so is there any way to do a delayed hibernation? or at least some way to provide the sudo password to an at or sleep prefixed command, beforehand?
i'm only interested in doing it straight up through the terminal, not through other 3rd party software cause i tried a few of those before i found out about shutdown and they didnt work very well.
I use two monitors,my problem is that I want to change the setup,so that the other monitor becomes default.There's no problem with my BIOS settings and I have tried every GUI tool that could help me(to my knowledge).Well I've found this URL...that helps a lot but I want to execute the command every time I boot before the splash screen(so that the login screen appears on the right monitor).I've tried rc.local but had no success.Any ideas on how to execute the command at boot time?
View 9 Replies View RelatedI was thinking of creating a little audio alarm clock with an mp3 and mpg123 to play a song from a cron job each day. How do you specify the time of day to execute a cron job?
View 4 Replies View Relatedhow can i execute vino-server at boot time, before my graphical login prompt (gdm ?) appears
View 1 Replies View RelatedI'm running xbmc on slackware64-13.1 and it's running great. However a python addon script is giving me trouble. The script contains some utf-8 characters, and by default I get an error because coding isn't declared in the script. I've added
Code: # -*- coding: utf-8 -*- to the scripts and they will work fine, but they are updated very frequently. I've tried messing around with turning on unicode console and such but I'm a bit in the dark on this. Is there a way I can get slack to handle those scripts without having to edit them every time I update?
I've been running Debian 8 jessie at the screen's native resolution (1280x800) via the following hack: [URL]
What's bugging me is that at random intervals, my screen shuts off while the laptop is still running, forcing me to hard reset.
opensuse v11.3
linux 2.6.34.7-0.5-desktop x86_64
ati radeon hd3200 (builtin to mb)
fglrx driver - distribution-specific build
At random intervals the video output is turned off for 2 - 3 seconds giving a black screen. (I suspect the 2 - 3 second blank time is how long it takes the monitor to recover after a loss of input signal.) The interval between events can vary from 1 minute to an hour to more than a week, and recently more than a month. Sometimes I get several per hour; other times not for two weeks. Hmm, there was a kernel update in the last week or so.At one time the cause was pointed at a USB driver problem since a number of USB log entries occurred at the same time as the screen blanking. That is not the case here;here is nothing in </var/log/messages> (or the dmesg output) that is anywhere near when a screen event happens.
Once every, say, 12 hours of use, I find that the mouse cursor spontaneously becomes unresponsive. The rest of the system is fine, and it responds to the keyboard, but the mouse does nothing. I'm pretty sure this isn't a problem with the mouse itself, because when it happens I've tried unplugging the mouse and plugging in a different one, and the problem persists. The problem doesn't seem to be correlated with any particular program or type of activity. I realize that this probably isn't much to go on. The next time it happens, is there at least anything I can do by way of diagnosis?
View 1 Replies View Related