This is a better alternative because it has control key and arrow keys
Python Snippets
Tuesday, June 19, 2012
taking a screenshot htc one v of ssh session of vpsville
hold the power button for 2 seconds and press the home key to take a screen shot
you will need to remove the lower back cover to install the microsd card
all filea are stored in this dcim locatoon
you will need to remove the lower back cover to install the microsd card
all filea are stored in this dcim locatoon
Tuesday, June 12, 2012
Basic Ubuntu Linux Commands for VPSVille
ls -l
the above command list the directory with added information
date
the above command shows the date
cat filename
list the contents of user supply filename
cat filename | more
list the file contents 1 screen at a time, press space to move to the next screen
rm filename
delete the file
ps ax
shows running process
top
like taskmanager on windows, type quit to quit
the above command list the directory with added information
date
the above command shows the date
cat filename
list the contents of user supply filename
cat filename | more
list the file contents 1 screen at a time, press space to move to the next screen
rm filename
delete the file
ps ax
shows running process
top
like taskmanager on windows, type quit to quit
Python read file splitlines alternatives
Due to the low memory conditions of a VPS, I found this better.
#create an array
file1TextArray=[]
file1 = open('/root/file1new.txt', 'r')
for line in file1:
file1TextArray.append(line[:-2])
file1.close()
Tested on Python3
Note this deletes the last two characters because the text file had \r\n as the new line delimeter
#create an array
file1TextArray=[]
file1 = open('/root/file1new.txt', 'r')
for line in file1:
file1TextArray.append(line[:-2])
file1.close()
Tested on Python3
Note this deletes the last two characters because the text file had \r\n as the new line delimeter
Monday, June 11, 2012
Day 3 on VPSVille nohup working!
root@x:~# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:02 init
3809 ? S 0:00 /usr/sbin/apache2 -k start
5916 ? Ss 0:00 SCREEN
5917 pts/1 Ss+ 0:00 /bin/bash
6130 ? S 0:00 /usr/sbin/apache2 -k start
7786 ? Rs 0:00 sshd: root@pts/0
7926 pts/0 Ss 0:00 -bash
13696 pts/3 R 4233:08 python vpsville-nohup.py
14242 pts/2 Ss+ 0:00 /bin/bash
15492 pts/3 Ss+ 0:00 /bin/bash
20411 ? Ssl 0:00 /usr/sbin/named -u bind
22133 pts/0 R+ 0:00 ps ax
23905 ? Ss 0:00 cron
23960 ? Ss 0:03 /sbin/syslogd -u syslog
24023 ? Ss 0:02 /usr/sbin/sshd -D
24217 ? S 0:00 /usr/sbin/apache2 -k start
24342 ? S 0:00 /usr/sbin/apache2 -k start
24476 ? S 0:00 /usr/sbin/apache2 -k start
29810 ? Ss 0:00 sendmail: MTA: accepting connections
29958 ? Ss 0:00 /usr/sbin/apache2 -k start
30191 ? Ss 0:00 /usr/sbin/xinetd -dontfork -pidfile /var/run/xinetd.pid -staya
root@x:~#
As you can see from the time, it's been up for a lot of minutes, almost 2.9 days
Friday, June 8, 2012
Killing a NoHup Python process in Ubuntu Linux hosted on VPSVille utilizing TOP and PS AX
- Okay, need to logout.
- Logging out kills the process.
- Use nohup python3 scriptfile.py &
- Yes ampersand at end
- use ls-l to list files with sizes to see if working
- kill process, issue command TOP
- from top, type k
- then type the process id should be a number
- Watch out for Memory Error
- ps ax list the process id also
- need to issue: kill -s SIGKILL PROCESSID
Subscribe to:
Comments (Atom)
