Jump to content

Leon

Administrators
  • Posts

    1235
  • Joined

  • Last visited

  • Days Won

    58

Everything posted by Leon

  1. I manage a couple of ClearOS servers, and sometimes the usual "top" just isent enough.. thats where htop comes in. Since htop is not in the package directory of ClearOS, you have to work-around it.. 1. Login as root on your COS 2. do -> wget http://packages.sw.be/htop/htop-0.8.3-1.el5.rf.i386.rpm'>http://packages.sw.be/htop/htop-0.8.3-1.el5.rf.i386.rpm [ENTER] 3. do -> rpm -i http://packages.sw.be/htop/htop-0.8.3-1.el5.rf.i386.rpm Wolla.. you know have htop .. simply type htop to start it...
  2. When installed on a virtual machine that is running a supported Linux operating system, Linux Integration Services for Hyper-V provides the following functionality: Driver support for synthetic devices: Linux Integration Services supports the synthetic network controller and the synthetic storage controller that were developed specifically for Hyper-V. Fastpath Boot Support for Hyper-V: Boot devices now take advantage of the block Virtualization Service Client (VSC) to provide enhanced performance. Timesync: The clock inside the virtual machine will remain synchronized with the clock on the host. Integrated Shutdown: Virtual machines running Linux can be shut down from either Hyper-V Manager or System Center Virtual Machine Manager, using the “Shut Down” command. Symmetric Multi-Processing (SMP) Support: Supported Linux distributions can use up to 4 virtual processors (VP) per virtual machine. 1. Download Linux Integration Components v2.1 a. Download Linux Integration Components v2.1 from Microsoft Download site. b. Extract the .exe file into a temp folder. You will need only LinuxIC v21.iso file. c. Place the LinuxIC v21.iso file into your VM host server where you can mount the ISO as a CDROM for your Centon Virtual Machine. 2. Installation You will need Development Tools installed to be able to compile the Integration Components. You could do that by running yum: yum groupinstall “Development Tools” NOTE: This command will try to use your network connection to download and if you used Synthetic Network Adapter for your Hyper-V machine you will not have internet connection. So make sure to install Development Tools during your Centos initial installation. Now make sure you added LinuxIC v21.iso file to your Hyper-V CDROM as Image. As the root user, mount the CD in the virtual machine by issuing the following commands at a shell prompt: mkdir /mnt/cdrom mount /dev/cdrom /mnt/cdrom Copy Linux Integration Services to the virtual machine and unmount CDROM that no longer needed: mkdir /opt/linux_ic_v21_rtm cp –R /mnt/cdrom/* /opt/linux_ic_v21_rtm umount /mnt/cdrom As the root user, run the following command to compile and install the synthetic drivers: cd /opt/linux_ic_v21_rtm/ make make install NOTE: If you’re using the x64 version of Centos, you have perform an extra step. Attach the Centos ISO that was used for installation in the virtual machine, and mount it: mkdir /mnt/cdrom mount /dev/cdrom /mnt/cdrom Install the adjtimex RPM for more accurate time keeping in the virtual machine: rpm –ivh /mnt/cdrom/Centos/adjtimex-1.20-2.1.x86_64.rpm To verify that all subcomponents are running,, as the root user, issue the following command at a shell prompt: /sbin/lsmod | grep vsc Please remmeber when using Network Adapters on Hyper-V, NIC names would be changed from eth0 to seth0. Uninstalling Linux Integration Services To uninstall Linux Integration Services, follow these steps. 1. From the Linux virtual machine, browse to the location where the installation files were copied (for example, /opt/linux). 2. From the command line, run the following command: make uninstall 3. Open /boot/grub/menu.lst or /boot/grub/grub.conf and remove the noprobe entries from the boot entries. 4. Restore the initrd image to the original file. For example: To configure the Synthetic Storage Controller: cp /boot/initrd-2.6.16.60-0.54.5-smp.backup0 /boot/initrd-2.6.16.60-0.54.5-smp5. Reboot the virtual machine.
  3. 1. Watch grass grow 2. Watch paint dry 3. Watch water boil 4. Shop cloth with women 5. Be “do-it-yourself” dentist 6. Give yourself a bypass operation with an electrical bread knife (or plastic spoon) 7. Taking the term “fall and break a leg” seriously.. 8. Renovate house ?!?! 9. Stand in line in the supermarket 10. Parachute jumping.. without a parachute.. (irony or sarcasm might have been used here…) Whats your most interesting things todo ? //Leon
  4. If you are still struggling on how to insert PHP Codes inside particular blog post, page or a widget sidebar for execution - then the following tutorial is for you. 1. Download: phpexec.txt.zip 2. Unzip and rename phpexec.txt to phpexec.php from here below... 3. Upload to /wp-content/plugins/ directory 4. Activate the plug-in from Wordpress administration menu Usage Anywhere in your post/pages where you want to execute a PHP Codes, insert before your php codes and your php codes. <phpcode> <?php echo "Current date and time: "; echo date("l dS of F Y h:i:s A"); ?> </phpcode> Security If you are running a blog with multiple users, you need to determine who can run this plug-in. Alter the settings in your Administration Menu. Options -> PHPExec Executing PHP codes in WordPress widget sidebar Installation Download php-code-widget.2.1.zip from below. Rename execphp.txt to execphp.php Upload to /wp-content/plugins/ directory Activate the plug-in from WordPress administration menu WIDGET: php-code-widget.2.1 Usage This plug-in work like a normal text widget except that it allows execution of PHP Codes. You can create up to 9 instances of this widget.
  5. The Mac OSX Terminal can become slow to launch over time, but there’s an easy solution to speed it up again. By deleting the Apple System Logs, you can shave the lag in opening and launching new Terminal window/tabs dramatically, in my case from about a three second delay to instantaneous! Here’s how to delete the log files and gain your Terminal launch speed back: 1. Open Terminal 2. Type: sudo rm -rf /private/var/log/asl/*.asl 3. Hit ENTER, close the terminal and test again.. Wolla
  6. Ever wondered if you could get rid of the spaces animation ? - from 10.6.x you can.. To disable the animation, do the following: Open /Applications/Utilities/Terminal.app. Copy and paste the following into the terminal window and then press enter: defaults write com.apple.dock workspaces-swoosh-animation-off -bool YES && killall Dock If you'd like to re-enable the animation, just do the following: Open Terminal and copy and paste the following into the terminal window and then press enter: defaults delete com.apple.dock workspaces-swoosh-animation-off && killall Dock Edit: Unfortunately, this only disables the "move directly to a space" animation that that is triggered by jumping to a space with a modifier-arrow key or modifier-number key or switching to a program in a different space. It does not disable the zoom-out/zoom-in animation for moving from spaces overview to a specific space. I use that method of transition fairly often, so it would be very nice if there was a switch for that one as well (or at least a way to speed up the animation).
  7. Hi, Today i needed to test the functionality of a webdav server. Check out this: http://www.webdav.org/neon/litmus/ To use: 1. Download 2. compile 3. Use Type this: # wget http://www.webdav.org/neon/litmus/litmus-0.12.1.tar.gz # tar -zxvf litmus-0.12.1.tar.gz # cd litmus-0.12.1 # ./configure # make # make install # litmus http:// Simple and fast //Leon
  8. I was just reading an blog post about pirate copying and decided to read a couple more, and i just can’t help be amazed about how freaking stupid the large organizations is, so let me help you and write a quick list for you. Why does people pirate copy: (Note, i am not saying that i pirate, simply stating the reasons) 1. We dont want to want to wait 3 months for a movie to come on a DVD when its been in the theaters 2. High Price, 200 SEK for a movie that you dont even know is good – is not worth it 3. Why do we have to buy a media to see a movie – how is that in anyway helping nature ? 4. Its time consuming to go and buy a movie vs. just downloading it.. 5. Some times its impossible to find a place to buy the movie or serie you want to see – downloading it the only option.. eg Startrek ? 6. Prices is not adapted to local pricing.. eg. a DVD sometimes cost the double in sweden as what it does in USA Why is it so hard just to make ONE online movie service where you can rent and see everything and make sure that everyone can use it. It escapes my mind why companies can’t get this into their thick skull, it does _NOT_ help to hunt down pirates and send them fines / send them to jail.. try solving the problem instead punishing people.. after all.. the people you punish is your customers.. What do you think ?
  9. Hi,I just bought a WANSER-R / R3210 / USB NAS Dongle.. cool little fucker I have been using the NAS Adapter for a few days now and I am quite impressed. I am using the unit with a 200GB Hitachi SATA drive in an USB 2.0 enclosure and the adapter recognizes and uses the hard drive flawlessly. Over SMB I get speeds around 8MB/sec when using Ethernet and around 2MB/sec over Wifi, which is in line with the expected speed for those networks. The NAS adapter runs smoothly even under heavy load (4 torrents, uploading to the HDD via wifi and streaming a video off the drive at he same time is no problem). The unit is entirely controlled via a web interface and can act both as a DHCP client or server. Both SMB and FTP allow multiple users and access levels.The build in bit torrent client is reasonably fast and can handle up to 4 downloads simultaneously. Performance is quite solid and the unit is capable to resume downloads after a reboot (even though the manual claims differently). Overall I am quite impressed with this small device and was curious to find out what’s ticking on the inside. Unfortunately, the casing had no visible way of opening it and I didn’t want to break the small device, so I did some Internet research. The hardest part was to find the latest firmware, but here it is: Version 1.54 (G5S5020300154E2 L:1.20E): G5S5020300154E0.zip Version 1.59b (G5S5020300159B0): G5S5020300159B0.zip version 1.66a (from http://ulc.sudhop.com/): R3282_1_66a_NAS903.zip Just unpack it and follow the readme….Enjoy!
  10. iCloud's 'Documents in the Cloud' doesn't let you do much except upload iWork files for use with iOS devices. To use those documents on another Mac, you have to download the file using the iCloud web interface. Poking around in the ~/Library folder, you can find a 'Mobile Documents' folder that is used for syncing iWork documents. But it turns out you are not limited to iWork files if you just want to sync between Macs (i.e. no iOS use). If you are using iCloud and have the 'Documents & Data' option selected in the preference pane, you can navigate to ~/Library/Mobile Documents. Depending on whether or not you've used iWork and synced documents to iCloud, you may or may not find folders there for each of the iWork applications (e.g. com~apple~numbers). This doesn't really matter. What is of use is that any files put into the ~/Library/Mobile Documents folder will automatically upload to iCloud and push to any other Mac you have that is signed in to the same iCloud account and has the 'Document & Data' iCloud preference checked. Lion even notifies you of version conflicts and allows you to resolve them when you open the document. While its not entirely like with mobileme - its one step in the right direction
  11. What Happened to the Mail I Sent? UPDATE: Thanx to Philippe Mathot there is now a even easier solution - simply use the application below. Head over to OSX Latitude to get it: https://osxlatitude.com/index.php?/topic/375-how-to-request-read-receipts-in-mac-os-x-mail/ Have you ever wondered what happened to a message you sent? Has a spam filter's ruthless rule befallen it, or did it never arrive? Was it read but forgotten? When you send an email in Mac OS X Mail, the message will be delivered to its recipient promptly — usually, but not always. To get some idea of your every email's fate, you can request read receipts. Typically, the recipient will be asked to confirm the message has been opened. While this is no guarantee the content has been read or even understood, such read receipts can still be useful to rule out some possibilities of failure and maybe quiet a wandering mind. Request Read Receipts in Mac OS X Mail To make Mac OS X Mail request a read receipt for every message you send: Open Terminal. Type "defaults read com.apple.mail UserHeaders". Press Enter. If that command returns "The domain/default pair of (com.apple.mail, UserHeaders) does not exist": Type defaults write com.apple.mail UserHeaders '{"Disposition-Notification-To" = "Name "; }' replacing Name with your name and email@address with your email address. The complete line could read "defaults write com.apple.mail UserHeaders '{"Disposition-Notification-To" = "Heinz Tschabitscher "; }'", for example. If the "defaults read" command above returns a line of values that starts with "{" and ends in "}": Highlight the entire line. It might read something like {Bcc = "[email protected]"; }, for example. Press Command-C. Type "defaults write com.apple.mail UserHeaders '" (excluding the outer quotation marks). Press Command-V. Type "'". Insert '"Disposition-Notification-To" = "Name "; ' in front of the closing "}" character, replacing Name with your name and email@address with your email address. The line might now read defaults write com.apple.mail UserHeaders '{Bcc = "[email protected]"; "Disposition-Notification-To" = "Heinz Tschabitscher "; }' , for example. Press Enter. Not Only Request but also Respect and Send Read Receipts Unfortunately, Mac OS X Mail does not respect read receipts. If you get an email requesting a read receipt, nothing special happens. Using some JavaScript and Mail rules, you can mimic some of the behavior and send simple receipts upon request. These do not fully conform to the standard and will not be interpreted as read receipts by the sender's email program. Of course, the plain language acknowledgment of receipt will still be useful. Disable Automatic Read Receipt Requests Again in Mac OS X Mail To turn requesting a read receipt for every message back off: Execute "defaults delete com.apple.mail UserHeaders" at Terminal command prompt to delete all custom headers or set UserHeaders back to what it was before you added "Disposition-Notification-To". Full Email Accountability and Control For full knowledge and control over the fate of the emails you send, you can employ a certified email service.
  12. You can use Debian on Hyper-V with 4 vCPU support. 1) Install a clean Debian 5.0.6 2) Do following: apt-get update aptitude update wget -c http://www.yusufozturk.info/linux/linux-image-2.6.36-hyperv-debian.x86_64.deb wget -c http://www.yusufozturk.info/linux/linux-headers-2.6.36-hyperv-debian.x86_64.deb apt-get install build-essential dpkg -i linux-image-2.6.36-hyperv-debian.x86_64.deb linux-headers-2.6.36-hyperv-debian.x86_64.deb echo -e "hv_vmbus\nhv_storvsc\nhv_blkvsc\nhv_netvsc" >> /etc/initramfs-tools/modules update-initramfs -u That’s it. Reboot your server with new kernel. Now you can use synthetic ethernet and 4 vCPU. Also integrated shutdown is available: You can use CPU stress tool for tests. UPDATE: For Debian 6 this kernel works: http://docs.homelinux.org/doku.php?id=using_linux_ic_with_debian_squeeze#using_hyper-v_linux_integration_components_with_debian_squeeze_64bit
  13. Basically, you first create a share on your Linux/Windows for your Time Machine backups to go. I called mine "macbackup" and gave my user full permissions to the folder as well as set it to replicate so that I have a redundant backup of it. Next, open up a terminal window on the Mac and switch on the magic preference defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 Now, mount the share on your Windows Home Server using Finder. Back in the terminal window, you now have to create a sparse bundle file. Take a look at the links above for more information, but basically you type a command like the following hdiutil create -nospotlight -library SPUD -size [size_in_gigs]g -fs HFS+J -type SPARSEBUNDLE -volname "Backup of [hostname]" -verbose [hostname]_[mac_addr].sparsebundle Replacing [size_in_gigs] for the size you want to constrain time machine to use, [hostname] for the machine name of your mac and [mac_addr] for the mac address of the interface you want to use for the bacup (usually eth0 as doing the backup over wifi will take a while) I used something like the following command: hdiutil create -nospotlight -library SPUD -size 250g -fs HFS+J -type SPARSEBUNDLE -volname "Backup of martinmbp" -verbose martinmbp_002332c5437e.sparsebundle Then copy this over to the mounted share using something like cp -r [hostname]_[mac_addr].sparsebundle /Volumes/mackbackup/. Now, go to System Preferences, Time Machine and select Change Disk.. Pick your WHS share that you have copied the .sparsebundle to and then leave for a long time if this is your first backup. Seems to be working for me. I'll report back and edit this answer if I find any issues with it. Mileage may vary as Apple obviously left this functionality out for a reason, I'm assuming it is a technical one rather than a ploy to sell more Time Capsules so we'll see what happens. Update: Been using for few days so far and seems to be working ok. A couple of caveats: Reports of issues if you put the machine to sleep while performing a back-up. I did this as a test and had trouble getting the back-up volume to un-mount. In the end I had to reboot the machine to release the lock on whatever file was causing the issue. Problems if trying to restore from Time Machine backup using System CD. Because you have to set a preference to get the machine to pick up unsupported devices like Windows Home Server shares, it is unclear if you can restore a whole machine from the System CD that doesn't have the preference set. Personally I have a few whole image backups that I have kept around that I could restore from an external disk so this hopefully won't be an issue for me - the Time Machine stuff is really just an incremental backup. However I still need to test the restore process
  14. By default in Mac OS X browsing to Windows 2008 and 2003 Servers is extremely slow, navigating from one directory level to the next can take a minute or longer. I utilize my Mac to access the office Windows 2008 and 2003 file servers and the speed to access these shares makes it almost impossible to work from a Mac. To make things even worse I do most of my work through a Cisco SSL VPN loaded on my Mac from home over a broadband connection. Out of pure frustration I started playing with settings in my SMB configuration and have found a way in Mac OS 10.6.7 to speed the process up drastically to where navigating folders is almost instantaneous (including over my VPN). This makes the Mac work just as fast as my Windows 7 workstation when connecting to Windows servers. In order to fix the slow SMB browsing you will need to edit the smb.conf file on your Mac. The file is only editable by the user root so you'll need to use a text editor that can authenticate (like BBEdit or TextWrangler) or do this in the Terminal. I did the latter. I had root enabled and used the 'su' command, but you can just use 'sudo' with your administrator account to accomplish the same thing. Once the file has been edited and saved you will need to restart your mac for the changes to take effect. Mac OS X being Unix at the core utilizes the Samba daemon to access Windows networks and the smb.conf file controls how Samba accesses these Windows shares. 2br Launch the Terminal (Applications/Utilities/Terminal). You can use the vi or the pico editors included with Mac OS X to edit the smb.conf file by typing sudo vi /etc/smb.conf or sudo pico /etc/smb.conf. You will be prompted for a password, utilize the password for your admin account. I used vi. In order to change anything within the file you will need to put vi into insert mode by typing the letter i (at the bottom you will see the word insert). Some handy vi editor tips: vi has 2 modes: 'Command Mode' and 'Insert Mode.' To switch between modes you use the letter i in Command Mode to switch to Insert Mode and when in Insert Mode you use the Escape key to switch to Command Mode. File saves are done in Command Mode and edits to the file are done in Insert Mode. You can search the file you are editing in Command Mode by typing /searchstring where searchtring is what you are looking for in the file. Scroll down to the line use spnego = yes and change the yes to a no. Continue to scroll down to stream support = yes and change this to no, on the line immediately below that says ea support = yes change this to no. In the next group that says darwin_streams:brlm = yes change this to no. Save the file by first taking vi out of insert mode by pressing the Escape key. Then to save the file and quit vi type :wq and press Return. Restart your Mac. This simple fix for slow SMB browsing decreased the time to open shares and files on my Windows 2008 server from my Mac drastically.
  15. 1. So let’s begin creating a pseudo shell named /bin/ftpaccess debian:~# touch /bin/ftpaccess debian:~# echo 'echo "This accout is for ftp access only"' > /bin/ftpaccess debian:~# echo 'exit 0' >> /bin/ftpaccess debian:~# chmod +x /bin/ftpaccess 2. It’s also necessary to include the just created pseudo FTP shell/bin/ftpaccess in your /etc/shells file. echo '/bin/ftpaccess' >> /etc/shells 3. Then edit your /etc/passwd and change in the user shell, you should edit a line similar to: ftp-user:x:1011:1005:FTP User,,,:/home/ftp-user:/bin/bash Afterwards the same user /etc/passwd line declaration should look like: ftp-user:x:1011:1005:FTP user,,,:/home/ftp-user:/bin/ftpaccess Now the ftp-user user should have an FTP file transfer upload/download access to the server but it’s SSH, SCP and SFTP access will be disabled. Talking about disabling access of SFTP it’s worthy to mention the RSSH Project . RSS is quite cool and is able to restrict a shell access via SSH but same time allow users to use the SFTP and SCP protocols. Other user feedback/experience for accomplishing the same task is very welcome!
  16. The first question that popped into my head after it was revealed that Lion would be a download only upgrade was "what if I need a boot disk?" I've had too many hard drives crash, and had to reinstall too many operating systems to do without a physical boot disk. Plus I've never been one to tote around an external bootable hard drive. Thankfully creating a Lion boot disk is quite painless. 1. Purchase and download Lion from the Mac App Store on any Lion compatible Mac running Snow Leopard. 2. Right click on “Mac OS X Lion” installer and choose the option to “Show Package Contents.” 3. Inside the Contents folder that appears you will find a SharedSupport folder and inside the SharedSupport folder you will find the “InstallESD.dmg.” This is the boot disc image we have all been waiting for. 4. Copy “InstallESD.dmg” to another folder like the Desktop. 5. Launch Disk Utility and click the burn button. Select the copied “InstallESD.dmg” as the image to burn, insert a standard sized 4.7 GB DVD, and wait for your new Lion Boot Disc to come out toasty hot.
  17. Nginx and Apache2 are running great but there is only one tiny problem with the visitors ip’s. Normaly I let my nginx instance do the logging job, but if you let your Apache do it you will get some problems. Apache will see all incoming requests as coming from localhost (127.0.0.1). Right they are all from nginx. Solution: # Install rpaf module for Apache2 aptitude install libapache2-mod-rpaf # Enable it a2enmod rpaf Now add this to your apache.conf or httpd.conf RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 10.0.0.1 RPAFheader X-Forwarded-For # Restart apache2 /etc/init.d/apache2 restart This tells Nginx to forward the original remote IP-address in the header as it proxys ro Apache. Add this 3 Lines to your nginx.conf or to your enables site config: proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  18. It seems like apple screwed up something in Lion DP4, causing GMA950 graphic adapters to show poor backlight light / dark screen. Replacing the AppleIntelIntegratedFramebuffer.kext in /s/l/e with the one from DP3 fixes the issue. I'v attached it to this blog post, use kext Helper to replace it and reboot.. Update 1) As mario pointed out, remember to repair permissions. //Leon FILE: AppleIntelIntegratedFramebuffer.kext_.zip
  19. Sometimes it is very annoying to wait ten's of seconds to finish remote ssh server's reverse dns lookup procedure. It can be disabled on the server side but this process has a few tricks. First of all, you can make "UseDNS no" in /etc/ssh/sshd_config file, default answer is yes and if this line not shown in your config file, just add it to as below: UseDNS no This directive tells sshd process to check resolved host name for the connected client's ip address maps back to the very same ip address or not. After you have done the change, restart your SSH server with a: /etc/init.d/ssh restart NOTE: It does not prevent the sshd server from performing any DNS lookups at all. That's not the purpose of that directive. In order to remove dns lookups completely, you have to use -u0 options when starting sshd server. You can easily add this options to /etc/default/ssh or/etc/sysconfig/sshd or elsewhere suitable for your distribution. -u0 option's means that it will not put hostnames into the utmp structure (i.e. what you see when you type "who" at the shell prompt), which means that sshd will not perform DNS lookups for that purpose. However there are still cases where a lookup has to be performed when a user has "from=" like entries in his authorized_keys file, or when authentication methods or configuration directives are used that involve hostnames.
  20. The other day i wanted to test LogMeIn Hamachi on a older G4 - to my big disappointment the damn thing is only supported on Intel macs.. and best of all.. you first get to know about it after installation. good work.. NOT.. Ever funnier, the uninstall app is also for Intel only.. WTF?!?!?! .. well ok.. after a great deal of research i put together a guide for howto uninstall the damn thing. 1. Remove the actual app from /Applications 2. Open terminal and type: sudo rm /usr/sbin/tuncfg sudo rm /usr/bin/hamachi sudo rm /usr/bin/hamachi-init rm -r /home//.hamachi Now remove any Hamachi/LogMeIn of the entries from: /System/Library/LaunchDaemons /Library/LaunchDaemons /System/Library/LaunchAgents /Library/LaunchAgents .. and finally remove: /System/Library/LaunchDaemons/tuncfgd.plist .. reboot.. Home this helps somebody out there...
  21. UNIX includes a program named 'cron' to handle the execution of tasks on a specified schedule, regardless of whether the user is logged in or not. Cron does this through a series of simple text files known as 'crontabs' which control the scheduling of jobs. The cron daemon is used by the system for scheduled daily, weekly, and monthly maintenance, and can be used by users to run various programs at set intervals, such as to handle my site backup program as described elsewhere on this site. Read the rest of this article if you'd like a simple overview of what cron is and how it can be used. The system cron tasks are stored in /etc/crontab. You can "cat" this file to get an example of what a crontab looks like: user% cat /etc/crontab # $NetBSD: crontab,v 1.13 1997/10/26 13:36:31 lukem Exp $ # # /etc/crontab - root's crontab # SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin HOME=/var/log #min hour mday month wday user command */10 * * * * root /usr/libexec/atrun # do daily/weekly/monthly maintenance 15 3 * * * root sh /etc/daily... 30 4 * * 6 root sh /etc/weekly... 30 5 1 * * root sh /etc/monthly... [NOTE: There are TABS between the items, so don't copy/paste anything you see here; type it with tabs between fields!] If you want even more info on what the system is actually doing for maintenance, follow the path under the COMMAND column, and "cat" the actual .sh files ... there's quite a bit going on for which you might like to leave your system running at least overnight on occasion! The basic format of the file is relatively self-explanatory, sort of! An "*" in a column reads as "every", and the "*/10" in the first command line means "every 10th minute". So the weekly maintenance is set to run at 30 mins, 4 hours (or 4:30am) every day of every month, on the 6th day of the week. After the scheduling block is a column for which user the command will run as (root in this case), and what the acutal command is that will be executed. You can add new system-wide tasks to the cron program by inserting lines into this file (but you must be 'root' in order to do so). More applicable to a typical user would be to schedule their own cron task. I did just that for my backup solution mentioned in another hint. To do this, I first copied the root crontab to a file in my directory (cp /etc/crontab ~/mycrontab). I then edited the 'mycrontab' file to look like this (I've skipped the header, which I left the same as the root file): #min hour mday month wday command 25 2,14 * * * sh path/to/getmybackup.sh The 'sh getmybackup' runs my backup download shell script (see the related article on automated backups), and the time section is set to run it twice a day - at 2:25am, and 2:25pm (1425 in military time). Once the edited file has been saved, the final step is to tell the 'cron' program to schedule the task: crontab mycrontab That's all there is to it; the task is scheduled and will be executed twice a day at the specified time, as long as my machine is powered on. You can see a list of currently scheduled tasks by typing "crontab -l" at the command prompt, and you can cancel a crontab with "crontab -r". Hope this helped shed a little light on the dark world of cron...and as usual, there's much more to this subject than I've covered here, but this should be enough to get you started. Good way to edit your crontab on mac: EDITOR=nano crontab -e
  22. Creds goes to Kevin Worthington I optimized and corrected a few links so here is a ready to use guide for installing nginx on OSX 10.6+ #!/bin/bash ## DOWNLOADS sudo curl -OL h http://ftp.exim.llorien.org/pcre/pcre-8.01.tar.gz > /usr/local/src/pcre-8.01.tar.gz sudo curl -OL h http://nginx.org/download/nginx-0.8.33.tar.gz > /usr/local/src/nginx-0.8.33.tar.gz ## Install PCRE sudo mkdir -p /usr/local/src cd /usr/local/src tar xvzf pcre-8.01.tar.gz cd pcre-8.01 ./configure --prefix=/usr/local make sudo make install cd .. ## Install Nginx tar xvzf nginx-0.8.33.tar.gz cd nginx-0.8.33 ./configure --prefix=/usr/local --with-http_ssl_module make sudo make install ## Start Nginx sudo nginx You may even paste this into eg. build.sh to make it even easier.. after installation you will find: nginx.conf -> /usr/local/conf stop nginx: killall nginx start nginx: /usr/local/sbin/nginx
  23. This is an example of a bash script which checks for some running process (daemon or service) and does specific actions (reload, sends mail) if there is no such process running. Requirements: Any modern Linux or OSX distribution Nearly any unix sistem with recent bash version, grep, ps We call ps (process list) command to list every system process and then use grep(filter) command to check if our process name is in that list, for example: $ ps ax | grep httpd 592 ?? Ss 8:22.25 /usr/local/apache/bin/httpd 3706 ?? I 0:58.06 /usr/local/apache/bin/httpd 3707 ?? I 0:40.12 /usr/local/apache/bin/httpd 3708 ?? I 0:49.56 /usr/local/apache/bin/httpd 3709 ?? I 1:02.86 /usr/local/apache/bin/httpd 3710 ?? I 1:12.26 /usr/local/apache/bin/httpd 3711 ?? I 1:20.03 /usr/local/apache/bin/httpd 3712 ?? I 0:48.79 /usr/local/apache/bin/httpd 3714 ?? I 1:01.60 /usr/local/apache/bin/httpd 3715 ?? I 0:58.91 /usr/local/apache/bin/httpd 3716 ?? I 0:42.88 /usr/local/apache/bin/httpd 28363 p3 S+ 0:00.01 grep httpd But if there is no such process, grep (filter) command will match itself, because command argument has exactly same string which is searched for: $ ps ax | grep nosuchprocess 28372 p3 S+ 0:00.01 grep nosuchprocess So, we have to add additional 'grep -v grep' filter that will remove process which command line contains 'grep' i.e. grep itself. Here is a script wich checks if SERVICE (variable at the beginning of script which contains service name) is running, and if it's not running, mails warning message to root: source code: bash script #!/bin/sh SERVICE='httpd' if ps ax | grep -v grep | grep $SERVICE > /dev/null then echo "$SERVICE service running, everything is fine" else echo "$SERVICE is not running" echo "$SERVICE is not running!" | mail -s "$SERVICE down" root fi WARNING!!! If you process name is too short and is substring of some other process command line, suggested approach could fail (for example, you checking for 'testd' process, but have running 'testdoo-doo-doo" which will result false positive) Though, highly unlikely, but if your process name will begin with 'grep', suggested approach could fail
  24. iCloud’s ‘Documents in the Cloud’ doesn’t let you do much except upload iWork files for use with iOS devices. To use those documents on another Mac, you have to download the file using the iCloud web interface. Poking around in the ~/Library folder, you can find a ‘Mobile Documents’ folder that is used for syncing iWork documents. But it turns out you are not limited to iWork files if you just want to sync between Macs (i.e. no iOS use). If you are using iCloud and have the ‘Documents & Data’ option selected in the preference pane, you can navigate to ~/Library/Mobile Documents. Depending on whether or not you’ve used iWork and synced documents to iCloud, you may or may not find folders there for each of the iWork applications (e.g. com~apple~numbers). This doesn’t really matter. What is of use is that any files put into the ~/Library/Mobile Documents folder will automatically upload to iCloud and push to any other Mac you have that is signed in to the same iCloud account and has the ‘Document & Data’ iCloud preference checked. Lion even notifies you of version conflicts and allows you to resolve them when you open the document. While its not entirely like with mobileme – its one step in the right direction Enjoy!
  25. This tutorial will guide you through the setup of a fully-featured seedbox running on a Debian or Ubuntu system, including: libtorrent 0.13.0 rTorrent 0.9 ruTorrent Web UI (3.0) This guide has been tested with Debian 6 (x86_64) and Ubuntu 11.04 (x86_64). To start, access your VPS via SSH (as the root user) and do the following to update your platform and install some required dependencies: # apt-get update # apt-get install subversion build-essential automake libtool libcppunit-dev libcurl3-dev libsigc++-2.0-dev unzip unrar-free curl libncurses-dev # apt-get install apache2 php5 php5-cli php5-curl Enable scgi for Apache: # apt-get install libapache2-mod-scgi # ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load Install XMLRPC: # mkdir /install;cd /install # svn checkout http://xmlrpc-c.svn.sourceforge.net/...mlrpc-c/stable xmlrpc-c # cd xmlrpc-c # ./configure --disable-cplusplus # make # make install Intall libtorrent: # cd /install # wget http://vps6.net/src/libtorrent-0.13.0.tar.gz # tar xvf libtorrent-0.13.0.tar.gz # cd libtorrent-0.13.0 # ./configure # make # make install Install rTorrent: # cd /install # wget http://vps6.net/src/rtorrent-0.9.0.tar.gz # cd rtorrent-0.9.0 # ./configure --with-xmlrpc-c # make # make install # ldconfig Create required directories: # mkdir /home/seeder1/rtorrent # mkdir /home/seeder1/rtorrent/.session # mkdir /home/seeder1/rtorrent/watch # mkdir /home/seeder1/rtorrent/download Setup .rtorrent.rc file (rTorrent config): # cd ~/ # wget http://vps6.net/src/.rtorrent.rc # cp .rtorrent.rc /home/seeder1/ (Edit the settings in .rtorrent.rc, like max upload/download speed, max connected peers, etc, as needed.) Install rTorrent: # cd /install # wget http://vps6.net/src/rutorrent-3.0.tar.gz # tar xvf rutorrent-3.0.tar.gz # mv rutorrent /var/www # wget http://vps6.net/src/plugins-3.0.tar.gz # tar xvf plugins-3.0.tar.gz # mv plugins /var/www/rutorrent # rm -rf /var/www/rutorrent/plugins/darkpal # chown -R www-data:www-data /var/www/rutorrent Secure /rutorrent: # a2enmod ssl # a2enmod auth_digest # a2enmod scgi # openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem # chmod 600 /etc/apache2/apache.pem # htdigest -c /etc/apache2/passwords seedbox seeder1 (Enter a password of your choice when prompted, you will use this to log in to the ruTorrent web UI.) # cd /etc/apache2/sites-available/ # rm -rf default # wget http://vps6.net/src/default # a2ensite default-ssl # /etc/init.d/apache2 reload Install screen: # apt-get install screen Start rTorrent in a detached shell using screen: # screen -fa -d -m rtorrent (To start rtorrent automatically when the VPS is booted, add the above command to /etc/rc.local) You can now access ruTorrent at http://xx.xx.xx.xx/rutorrent/ (replace xx.xx with your server's IP address). You should be greeted with a login prompt, where the username is "seeder1" and the password is the one you set above in the "secure /rutorrent" section. .. and there you go
×
×
  • Create New...