Sponsored Content
Top Forums Shell Programming and Scripting Running a KSH file from VPS on Godaddy Post 302944499 by uksatman on Tuesday 19th of May 2015 04:16:27 PM
Old 05-19-2015
the file its self i run is a ksh

but the code i gave you is from a "thank you page " after a payment from pay pal.

the code part is
Code:
// Redirect to custom page on purchase
Am_Di::getInstance()->hook->add(Am_Event::THANKS_PAGE, 'onThanksPage');
function onThanksPage(Am_Event $event){
/* @var $di Am_Di */
$di = Am_Di::getInstance();
/* @var $invoice Invoice */
$invoice = $event->getInvoice();
/* @var $controller ThanksController */
$controller = $event->getController();

$controller->redirectLocation('/compsetup');
}

// Exec C/N script
Am_Di::getInstance()->hook->add(Am_Event::USER_MENU, 'myAddMenuItem');
function myAddMenuItem(Am_Event $event)
{
    $menu = $event->getMenu();
    $menu->addPage(
        array(
            'id' => 'compsetup-id',
            'controller' => 'compsetup',
            'module' => 'default',
            'label' => "Complete Setup",
            'order' => 500
    ));
}
 
class CompsetupController extends Am_Controller // a Zend_Controller_Action successor
{
    function indexAction()
    {
        $user = $this->getDi()->user; //currently authenticated customer or throws exception if no auth
 
        $this->view->title = "Complete Setup";
        $this->view->content = doScriptExec();
        $this->view->display('layout.phtml');
    }
}

function doScriptExec() {
// Get list of used products
$prodids = file_get_contents(__DIR__ . "/used_products.txt");
foreach (Am_Lite::getInstance()->getAccess() as $a) {
  if ((strtotime($a['begin_date']) < time()) && (strtotime($a['expire_date']) > strtotime("today")) && (!strstr($prodids, "$a[access_id]\n"))) {
    $access_id = $a['access_id'];
  }
}
  if (!$access_id) return "<p style=\"color: RED;\">You have already generated a code for a connection or have not bought a membership. If this you feel is an error, please email the site owner.</p>";
  if (!$_REQUEST['corn']) {
    return '<form method="post" action="#"><select name="corn"><option value="c">C</option><option value="n">N</option><option value="mg">MG</option></select><input type="submit" value="Setup" /></form>';
  } else {
    $arg = $_REQUEST['corn'];
    $prodids = $prodids . "$access_id\n";
    file_put_contents(__DIR__ . "/used_products.txt", $prodids);
    
return shell_exec(__DIR__ . "/codegen $arg");  }
}

as started this works 80-99% on my vps so is a working live script.

but i want to put the script on my godaddy account as closing my vps and moving

so i need to now how to change the bottom to run the script from there

loads of sites say ssh user@host and then the part for file
but cant seem to work
i think needs the ssh keys set up

i even tried

ssh root@host 'bash -s' < /codegen to get a sintext error

Last edited by uksatman; 05-19-2015 at 05:52 PM..
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Editing file during running ksh in HP failed

Hi falks, I have the following program: #!/bin/ksh ed -s /home/ias/v9.0.3/j2ee/OC4J_RiGHTv_HPCD2/applications/Xbip/Xbip/WEB -INF/config/application.properties <<EOF >/dev/null 1 d . d . a application.filePath.core = /core-HPCD2/Html/ application.filePath.xbip =... (2 Replies)
Discussion started by: nir_s
2 Replies

2. Windows & DOS: Issues & Discussions

Running KSH script In SFU

I tried to run my ksh scripts in SFU and it always says "not found" as in the example below: $ .file /bin/ksh: .file: not found Did I miss something in the SFU Installation? (2 Replies)
Discussion started by: ilak1008
2 Replies

3. Solaris

Problems Running KSH on Solaris 10

Hi, I am currently in the process of testing upgrading from Solaris 8 to Solaris 10. one problem i have encountered is when i am running any of my batch scripts. All my scripts start with #! /bin/ksh so that they will excuted in the ksh shell. but the scripts will not run correctly. The... (3 Replies)
Discussion started by: dshakey
3 Replies

4. Shell Programming and Scripting

Running executables in ksh

I am trying a set up a very simple korn shell script. It has 2 basic steps. Firstly I read the first line of a text file (which is a file name) Secondly I run a fortran executable using that line I must be doing something wring because it wouldn't work. I know that the executable wants the... (4 Replies)
Discussion started by: larangunn
4 Replies

5. UNIX for Advanced & Expert Users

Running scripts without a hashbang - ksh anomaly?

I noticed some strange looking parameters on some processes on one of our servers, and after a little playing around we deduced that ksh seemed to be adding a (somewhat random) extra parameter when calling a script without a hashbang in it. It looks like it's the partial name of the parent... (10 Replies)
Discussion started by: CarloM
10 Replies

6. UNIX for Dummies Questions & Answers

Postfix Dovecot Roundcube Godaddy

Long story short, I have everything working in my SOHO which would include Postfix,Dovecot(imap),Roundcube,bind and is ready to recieve email from the outside using this tutorial: https://workaround.org/ispmail/wheezy I also setup my internal DNS server using: https://wiki.debian.org/Bind9... (2 Replies)
Discussion started by: metallica1973
2 Replies

7. Shell Programming and Scripting

How to download Images and Json file from server(godaddy) to Local machine (Ubuntu 14.04).?

Hi Guys, Just entering the Linux word, So I need help to write a script on my local machine(Ubuntu 14.04) that continuously check the particular folder(contains images) and a json file on the server and download whenever new images are added to that folder and whenever there is a change in the... (10 Replies)
Discussion started by: g4v1n
10 Replies

8. UNIX for Beginners Questions & Answers

Wget Cronjob, Godaddy.

Hello, I'm trying to automate a wget cronjob for Php 5.4 on Wordpress - using Cpannel on a linux server hosted by Godaddy. Below is the command I'm using, which isn't working. wget -q -O "/wp-cron.php?import_key=&import_id=&action=trigger" >/dev/null 2>&1 ========== EDIT Thank you so... (5 Replies)
Discussion started by: embus
5 Replies
LKSH(1) 						    BSD General Commands Manual 						   LKSH(1)

NAME
lksh -- Legacy Korn shell built on mksh SYNOPSIS
lksh [-+abCefhiklmnprUuvXx] [-+o opt] [-c string | -s | file [args ...]] DESCRIPTION
lksh is a command interpreter intended exclusively for running legacy shell scripts. It is built on mksh; refer to its manual page for details on the scripting language. It is recommended to port scripts to mksh instead of relying on legacy or idiotic POSIX-mandated behav- iour, since the MirBSD Korn Shell scripting language is much more consistent. LEGACY MODE
lksh has the following differences from mksh: o lksh is not suitable for use as /bin/sh. o There is no explicit support for interactive use, nor any command line editing or history code. Hence, lksh is not suitable as a user's login shell, either; use mksh instead. o The KSH_VERSION string identifies lksh as ``LEGACY KSH'' instead of ``MIRBSD KSH''. o lksh only offers the traditional ten file descriptors to scripts. o lksh uses POSIX arithmetics, which has quite a few implications: The data type for arithmetics is the host ISO C long data type. Signed integer wraparound is Undefined Behaviour. The sign of the result of a modulo operation with at least one negative operand is unspeci- fied. Shift operations on negative numbers are unspecified. Division of the largest negative number by -1 is Undefined Behaviour. The compiler is permitted to delete all data and crash the system if Undefined Behaviour occurs. o The rotation arithmetic operators are not available. o The shift arithmetic operators take all bits of the second operand into account; if they exceed permitted precision, the result is unspecified. o The GNU bash extension &> to redirect stdout and stderr in one go is not parsed. o The mksh command line option -T is not available. o Unless set -o posix is active, lksh always uses traditional mode for constructs like: $ set -- $(getopt ab:c "$@") $ echo $? POSIX mandates this to show 0, but traditional mode passes through the errorlevel from the getopt(1) command. o lksh, unlike AT&T UNIX ksh, does not keep file descriptors > 2 private. SEE ALSO
mksh(1) https://www.mirbsd.org/mksh.htm https://www.mirbsd.org/ksh-chan.htm CAVEATS
lksh tries to make a cross between a legacy bourne/posix compatibl-ish shell and a legacy pdksh-alike but ``legacy'' is not exactly speci- fied. The set built-in command does not have all options one would expect from a full-blown mksh or pdksh. Talk to the MirOS development team using the mailing list at <miros-mksh@mirbsd.org> or the #!/bin/mksh (or #ksh) IRC channel at irc.freenode.net (Port 6697 SSL, 6667 unencrypted) if you need any further quirks or assistance, and consider migrating your legacy scripts to work with mksh instead of requiring lksh. MirBSD May 2, 2013 MirBSD
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy