ubuntu-12.04

How to assign IP address to interface in python?

社会主义新天地 提交于 2019-12-20 20:16:16
问题 I have python script that set the IP4 address for my wireless and wired interfaces. So far, I use subprocess command like : subprocess.call(["ip addr add local 192.168.1.2/24 broadcast 192.168.1.255 dev wlan0"]) How can I set the IP4 address of an interface using python libraries? and if there is any way to get an already existing IP configurations using python libraries ? 回答1: Set an address via the older ioctl interface: import socket, struct, fcntl SIOCSIFADDR = 0x8916 sock = socket.socket

How to assign IP address to interface in python?

夙愿已清 提交于 2019-12-20 20:16:09
问题 I have python script that set the IP4 address for my wireless and wired interfaces. So far, I use subprocess command like : subprocess.call(["ip addr add local 192.168.1.2/24 broadcast 192.168.1.255 dev wlan0"]) How can I set the IP4 address of an interface using python libraries? and if there is any way to get an already existing IP configurations using python libraries ? 回答1: Set an address via the older ioctl interface: import socket, struct, fcntl SIOCSIFADDR = 0x8916 sock = socket.socket

How to add swap to and Amazon EC2 instance running Ubuntu 12.04 LTS?

点点圈 提交于 2019-12-20 14:19:14
问题 default Ubuntu 12.04 LTS doesn't create swap for some reason. Is there "proper" way to add it after install? root@aux3:/root# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 8.0G 1.4G 6.3G 18% / udev 1.9G 12K 1.9G 1% /dev tmpfs 751M 188K 750M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1.9G 0 1.9G 0% /run/shm /dev/xvdb 394G 79G 296G 21% /mnt root@aux3:/root# swapon -s Filename root@aux3:/root# free -m total used free shared buffers cached Mem: 3750 3730 20 0 75 3433 -/+ buffers

How to run meteor on startup on Ubuntu server

本小妞迷上赌 提交于 2019-12-20 14:08:42
问题 I learn meteorjs and I have a small remote VPS. I want: Set auto pulling from git repository my meteor project. Put script into auto start which run my meteor project as service. For example meteor run -p 80 -- production My server is Ubuntu 12.04 回答1: You should use Ubuntu way, which is Upstart: http://upstart.ubuntu.com/ http://manpages.ubuntu.com/manpages/lucid/man5/init.5.html How to define daemon job: http://newcome.wordpress.com/2012/02/26/running-programs-as-linux-daemons-using-upstart

How to run meteor on startup on Ubuntu server

邮差的信 提交于 2019-12-20 14:07:32
问题 I learn meteorjs and I have a small remote VPS. I want: Set auto pulling from git repository my meteor project. Put script into auto start which run my meteor project as service. For example meteor run -p 80 -- production My server is Ubuntu 12.04 回答1: You should use Ubuntu way, which is Upstart: http://upstart.ubuntu.com/ http://manpages.ubuntu.com/manpages/lucid/man5/init.5.html How to define daemon job: http://newcome.wordpress.com/2012/02/26/running-programs-as-linux-daemons-using-upstart

Remove log files using cron job

独自空忆成欢 提交于 2019-12-20 12:24:04
问题 Hi. I want to remove all log files from the last 7 days from a folder, but leave all the other files. Can I use the below command? How do you specify that it just delete the files with .log extension? find /path/to/file -mtime +7 -exec rm -f {} \; Do I need to write this command into some file, or can I just write it in command prompt and have it run automatically every day? I have no idea how to run a cron job in linux. 回答1: Use wildcard . And just put it in your crontab use the crontab -e

Can't ssh to AWS EC2: Identity file not accessible

僤鯓⒐⒋嵵緔 提交于 2019-12-20 10:17:05
问题 I'm unable to ssh to my EC2 server and am getting the error: ssh -i /Users/Skeniver/Keepass/skeniver.pem ubuntu@xx.xxx.xx.xxx Identity file /Users/Skeniver/Keepass/skeniver.pem not accessible: No such file or directory The file is definitely in the directory and I've chmod'd the directory to 755 and the file to 600: drwxr-xr-x 14 Skeniver staff 476 28 Nov 2012 Keepass -rw------- 1 Skeniver staff 1696 5 Oct 2012 skeniverkey.pem I'm pretty sure it's a permissions problem, but can't figure out

ADB not detecting device samsung i777 in ubuntu 12.04

对着背影说爱祢 提交于 2019-12-20 04:13:46
问题 this is the first time I am trying to setup adb to connect s2 with my ubuntu desktop. However, when I run adb devices and/or adb usb it cannot detect the s2. I have followed the following steps: create udev rules add to ~/.android/adb_usb.ini But the device is not getting connected while I am in the download/odin mode. My system is Ubuntu 12.04 64-bit and I am using the adb pre-packaged with android studio running lsusb shows me the following output: Bus 002 Device 004: ID 04e8:685d Samsung

pkg_resources.DistributionNotFound: The 'pip==1.5.4' distribution was not found and is required by the application [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-19 11:43:24
问题 This question already has answers here : The 'pip==7.1.0' distribution was not found and is required by the application (8 answers) Closed 4 months ago . Working on Ubuntu and Python 2.7.6, I am trying to use pip. When I type just pip followed by enter, I get: File "/usr/local/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3095, in <module> File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py

gcloud installation permission issue on Ubuntu 12.04

别说谁变了你拦得住时间么 提交于 2019-12-18 21:16:45
问题 I have installed PHP App Engine SDK first. Then, I installed Google Cloud SDK using: sudo curl https://sdk.cloud.google.com | bash but it's showing error while installing. Then, I installed Google Cloud SDK from a zip file, but it shows an error at the final stage of installation: /home/nikhil/google-cloud-sdk/install.sh Welcome to the Google Cloud SDK! Traceback (most recent call last): File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/install.py", line 20, in <module> from