CategoryComputers

Running Cron in Windows

We all would have heard of Cron jobs, if you are involved in website management, development or working on Linux/Unix machines.

What’s a cron?
Cron is nothing but an demon job running in the background without any user intervention. It gets executed automatically based on the predefined time interval.

Generally cron jobs are used to perform some maintenance activities in the server. For example, if you run a very popular blog, you can use the cron job to send out a weekly mail to all the users about the new blog posts. Or even removing any unwanted file uploads once a month. It’s not very unusual to link cron to *nix machines.

But coming to the reality, not all web developers(like me) work on *nix machines. I use WAMP stack for development and testing of my PHP projects. I often need to setup a cron for some important activities related to my applications. There is no straight forward way of setting up cron in your XAMP or XAMPP installation in Microsoft Windows.

Microsoft has included a tiny command line utility called “Task Scheduler” in its Windows Operating Systems. We invoke that utility by running schtasks.exe command.

Listing all current scheduled tasks:
In your Windows command prompt, type “schtasks” (without quotes) and press the Enter key. You can see the list of scheduled tasks in your machine.
schtasks
Adding a new scheduled task:
To add a new task, you can use “schtasks /create” command. For example the below command, makes the scheduler to run the php file “C:\wamp\www\oxwall\ow_cron\run.php” every 1 minute.
schtasks /create /sc minute /mo 1 /tn "My Cron" /tr "php -f C:\wamp\www\oxwall\ow_cron\run.php"
schtasks-add

It might ask for your windows password if necessary.The breakup of the command line options are provided below.

  • /sc – defines the schedule type. Possible values are MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE
  • /mo – defines how often the task runs within its schedule type (Example : every minute, every day, or weekly once).
  • /tn – gives your task a name to easily identify
  • /tr – command or utility to be ran

Once you are done, you could see the command prompt opening and closing for every minute as I set my cron for 1 minute. If you list down the tasks, you could see the new task added to the list.

Deleting an existing task:

To delete the task you can follow the below example.

schtasks /delete /TN "My Cron"

I have tested in my Windows XP and this should work for all other advanced versions too. For advanced options on modifiers please refer to Microsoft Windows Product Documentation.

Solution for Disk Drive Full error with USB Pen Drives

When you copy large files (greater than 3 GB) to your USB pen drive, it’s almost sure that you will get an error alerting that “Disk drive is full”. I am sure you will be surprised on seeing this error as your USB pen drive will have more than 10 GB available. I swear, I did got surprised. I confirmed that my USB drive has enough space.

I spend some time on finding out why this happens. And yet again it’s one of the mysteries of Windows OS. The reason behind this is that the USB device is in FAT32 file system and has some limitations. NTFS file system is not enabled on the devices to support high performance. The default option is to support quick removal of device.

I am using Windows XP and I assume this solution should work for any other Windows Operation Systems. Please correct me if my assumption is wrong.

Ok.. here is the solution.

  1. Right click on the USB drive having this problem in the Windows Explorer.
  2. Select “Properties”.
  3. Click the “Hardware” tab in the property dialog box.
  4. Find the USB drive disk in the list and double click it.
  5. Click the “Policies” tab.
  6. Select “Optimize for performance” and click “OK” button to close the dialog.

As you have now enabled “Optimize for performance”, you have disabled “Option for quick removeal” feature. So you should always remove your USB device by selecting “Safely Remove” option.

After these step, you can format your USB drive to NTFS file system. All the above steps are shown with actual images.

1

2

3

4

Monsta FTP – web based version of FileZilla

You would have came across a FTP application like FileZilla or WinSCP which you have used to access a FTP server. These are Windows based and you need to install them on your desktop if you want to use them.

As a developer I commonly come across some situations where I need to access a FTP server but not in the position to use the FileZilla or install it. And again I was today in that situation and did a small research to find an alternative approach.

I came across a web-based FTP application called MonstaFTP and it really helped me to achieve what I wanted.

Some words from the MonstaFTP website:

Say goodbye to desktop FTP software forever because Monsta FTP can connect you to any Windows or Linux server right from your browser, anywhere, anytime. Open source PHP/Ajax supports the latest HTML5 browser technologies to easily drag and drop files and folders from your desktop. Just 2 files to install and away you go, uploading, downloading, chmoding, renaming, deleting and editing.

The MonstaFTP script is 100% open source, has a compact installation, and shows what a HTML5 web application can offer with an easy installation process.

monsta

Some of the features of MonstaFTP script:

  • Open source GNU General Public License
  • Includes full PHP/Ajax source code
  • Written for programmers of all levels
  • Compact install of just 2 files (+ assets)
  • Supports FTP on Linux and Windows
  • Drag and drop files to upload and move
  • On-screen file editing
  • Multi-language support

The IE, Firefox, Chrome and Safari browsers are well supported. The official pages recommends Chrome browser for better visual performance and also states that IE version below 10 has limited support.

To have a look on how the application interface looks, you can have a preview at http://www.monstaftp.com/demo/ which is an official demo video.

Website Link : http://www.monstaftp.com/

Paris Desktop Wallpaper (HD)

Download 7 high quality wallpapers for your computer. The image might load little slow as the size of each image is 3MB. You can save those images for your local copy.

[nggallery id=1]