<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tequila Fish &#187; crontab</title>
	<atom:link href="http://www.tequilafish.com/tag/crontab/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tequilafish.com</link>
	<description>Ran-dumb ramblings of me...</description>
	<lastBuildDate>Thu, 26 Jan 2012 23:30:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>phpList with crontab: Permission denied.</title>
		<link>http://www.tequilafish.com/2006/03/14/phplist-with-crontab-permission-denied/</link>
		<comments>http://www.tequilafish.com/2006/03/14/phplist-with-crontab-permission-denied/#comments</comments>
		<pubDate>Tue, 14 Mar 2006 22:01:01 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[phpList]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[crontab]]></category>

		<guid isPermaLink="false">http://www.tequilafish.com/2006/03/14/phplist-with-crontab-permission-denied/</guid>
		<description><![CDATA[When processing your phpList queue with a crontab, you may get the following error: bash: /home/yourname/phplist: Permission denied This happens if your phplist script is not executable. It is an easy fix. Simply make the phplist script executable and it will run as expected: chmod u+x /home/yourname/phplist]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tequilafish.com%2F2006%2F03%2F14%2Fphplist-with-crontab-permission-denied%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tequilafish.com%2F2006%2F03%2F14%2Fphplist-with-crontab-permission-denied%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>When processing your phpList queue with a crontab, you may get the following error:<br />
<code>bash: /home/yourname/phplist: Permission denied</code><br />
This happens if your phplist script is not executable.  It is an easy fix.  Simply make the phplist script executable and it will run as expected:<br />
<code>chmod u+x /home/yourname/phplist</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tequilafish.com/2006/03/14/phplist-with-crontab-permission-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpList: processing with cron &amp; bash script: &#8220;Command not found.&#8221;</title>
		<link>http://www.tequilafish.com/2006/01/27/phplist-processing-with-cron-bash-script-command-not-found/</link>
		<comments>http://www.tequilafish.com/2006/01/27/phplist-processing-with-cron-bash-script-command-not-found/#comments</comments>
		<pubDate>Sat, 28 Jan 2006 00:34:31 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[phpList]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[crontab]]></category>

		<guid isPermaLink="false">http://www.tequilafish.com/2006/01/27/phplist-processing-with-cron-bash-script-command-not-found/</guid>
		<description><![CDATA[If you are trying to process your phpList queue using a crontab, you will have to set up the phplist script provided in the bin directory to work with your system. It looks like this: #!/bin/bash# script to run PHPlist from commandline. You may need to edit this to make it work # with your [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tequilafish.com%2F2006%2F01%2F27%2Fphplist-processing-with-cron-bash-script-command-not-found%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tequilafish.com%2F2006%2F01%2F27%2Fphplist-processing-with-cron-bash-script-command-not-found%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you are trying to process your phpList queue using a crontab, you will have to set up the <tt>phplist</tt> script provided in the <tt>bin</tt> directory to work with your system.  It looks like this:<br />
<code>#!/bin/bash# script to run PHPlist from commandline. You may need to edit this to make it work<br />
# with your shell environment. The following should work for Bash# in commandline mode, access is restricted to users who are listed in the config file<br />
# check README.commandline for more info# identify the config file for your installation<br />
CONFIG=/home/website/public_html/lists/config/config.php<br />
export CONFIG# alternatively you can use -c on the commandline# run the PHPlist index file with all parameters passed to this script<br />
/usr/bin/php /home/website/public_html/lists/admin/index.php $*</code><br />
Of course you will want to modify all the paths to fit your phpList install.  Most importantly, however, is to not forget to modify the FIRST line if need be.  Otherwise, if your bash interpreter exists elsewhere, when your try to execute your script you will get the following error:<br />
<code>/path/to/phplist: Command not found.</code><br />
For the majority of the installations out there, <tt>/bin/bash</tt> should be fine, however on some systems you may need to edit this to point to where your bash interpreter is installed.  In my case, I had to change it to <tt>/usr/local/bin/bash</tt>.</p>
<p>To future-proof my changes, I also symlinked to where my bash existed:<br />
<code>ln -s /usr/local/bin/bash /bin/bash</code><br />
That way I will not have to re-edit new versions of the <tt>phplist</tt> script in future phpList upgrades.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tequilafish.com/2006/01/27/phplist-processing-with-cron-bash-script-command-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpList with crontab: USER environment variable is not defined</title>
		<link>http://www.tequilafish.com/2005/11/17/phplist-with-crontab-user-environment-variable-is-not-defined/</link>
		<comments>http://www.tequilafish.com/2005/11/17/phplist-with-crontab-user-environment-variable-is-not-defined/#comments</comments>
		<pubDate>Fri, 18 Nov 2005 00:58:20 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[phpList]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[crontab]]></category>

		<guid isPermaLink="false">http://www.tequilafish.com/2005/11/17/phplist-with-crontab-user-environment-variable-is-not-defined/</guid>
		<description><![CDATA[When trying to automate processing of the mail queue and/or bounces in phpList, I came across the following error when calling the phplist command line script from a crontab: Error: USER environment variable is not defined, cannot do access check. Please make sure USER is defined. This happens because when a crontab executes, the $USER [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tequilafish.com%2F2005%2F11%2F17%2Fphplist-with-crontab-user-environment-variable-is-not-defined%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tequilafish.com%2F2005%2F11%2F17%2Fphplist-with-crontab-user-environment-variable-is-not-defined%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>When trying to automate processing of the mail queue and/or bounces in <a href="http://www.phplist.com/">phpList</a>, I came across the following error when calling the phplist command line script from a crontab:<br />
<code>Error: USER environment variable is not defined, cannot do access check. Please make sure USER is defined.</code><br />
This happens because when a crontab executes, the <strong><tt>$USER</tt></strong> variable is not set.  We must set it in our script.  So open up the phplist file and add the following:<br />
<code>USER=youusername<br />
export USER</code><br />
The entire file should now look like this:<br />
<code>CONFIG=/path/to/phplist/config/config.php<br />
export CONFIGUSER=yourusername<br />
export USER/path/to/php /home/yourusername/path/to/phplist/admin/index.php $*</code><br />
Note that you also must set the <strong><tt>$commandline_users</tt></strong> variable in your <strong><tt>config/config.php</tt></strong>:<br />
<code>$commandline_users = array("yourusername");</code><br />
With all of that in place, you can automate your queue and bounce processing with a crontab like this (adjust your paths accordingly):<br />
<code># Suppress crontab emails<br />
MAILTO=""<br />
# Process phplist queue daily, every half hour<br />
0,30 * * * * /home/yourusername/phplist -pprocessqueue<br />
# Process phplist bounces once a day, 5am<br />
0 5 * * * /home/yourusername/phplist -pprocessbounces</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tequilafish.com/2005/11/17/phplist-with-crontab-user-environment-variable-is-not-defined/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

