import sy.net
sy.net.sendmail(to=['unix@foo.com', 'me@foo.com'],
subject='Script output',
message='The script did ...',
attachments=['/var/log/script.log'])
Send an email
Parameters: |
|
---|
import sy.net
# Downloads file from http server
sy.net.download('http://server/file.tgz', '/var/tmp/myfile.tgz')
# Downloads file from ftp server
sy.net.download('ftp://server/file.tgz', '/var/tmp/myfile.tgz')
Warning
Proxy settings from the environment will be used. To be sure that no proxy is configured remove the variable before download:
import os
del os.environ['http_proxy']
del os.environ['ftp_proxy']
See the standard library urllib2 module for more advanced scenarios.
Download a file through http or ftp
synopsis: | Utilities for working with ip addressing and hosts |
---|
Add a hostname to /etc/hosts
Parameters: |
|
---|
Add a netmask to /etc/inet/netmask
Overwrites any old netmask with the same network IP
Test if host or ipaddress is pingable
Returns the network address given an ipaddress and netmask
Checks if a IP address is valid
Check if a port is reachable and open
Parameters: |
|
---|---|
Returns: | True if the port is open, False otherwise |
Warning
These are only (slightly) tested and only works on Solaris 10