command-line-interface

Run php script on background in PHP with nohup CLI

守給你的承諾、 提交于 2019-12-01 06:13:46
问题 I,m trying to run one php script in background. But its no working... I can only run directly from the ssh terminal. Using the same cli script. On the terminal, first i access the path: cd labs.lung.com.br/ztbot/bin/v2/php After that, i run my script in background: nohup php get_tweets.php > /dev/null & And it works! But, when i try to do the same thing with my php script: exec("nohup php get_tweets.php > /dev/null &"); doesnt work. Both files are in the same directory. I list the files in

Is there any way to know if a php script is running in cli mode?

末鹿安然 提交于 2019-12-01 03:29:16
... or the other way around, is there any way to know if a php script is running inside a web server? http://www.php.net/manual/en/function.php-sapi-name.php function is_cli() { return php_sapi_name() === 'cli'; } Typically, when running in CLI mode, the superglobals $argv and $argc will be set, and many of the typical contents of $_SERVER (e.g. request method) won't be available. In addition, pre-defined console streams such as STDIN , STDOUT and STDERR will be set up. You could check the $_SERVER variables ... such as: $_SERVER['SERVER_ADDR'] This will be empty if it is not executed through

How can I change the content-type of an object using aws cli?

岁酱吖の 提交于 2019-12-01 03:17:55
I've got several objects stored in Amazon S3 whose content-type I need to change from text/html to application/rss+xml . I gather that it should be possible to do this with a copy command, specifying the same path for the source and destination. I'm trying to do this using the AWS cli tools, but I'm getting this error: $ aws s3 cp s3://mybucket/feed/ogg/index.html \ s3://mybucket/feed/ogg/index.html \ --content-type 'application/rss+xml' copy failed: s3://mybucket/feed/ogg/index.html to s3://mybucket/feed/ogg/index.html A client error (InvalidRequest) occurred when calling the CopyObject

How to invoke octave script in unix shell

浪尽此生 提交于 2019-12-01 01:26:46
I have written an octave script file (.m) If anyone could point me out on how to run octave scripts on unix shell that would be really helpful. I do not want to execute the script by invoking octave program. I am new to unix and octave. Thanks in advance Yes, of course you can write an Octave program. Like so: $ cat octave_program #!/usr/bin/env octave ## Never forget your licence at the top of the files. 1; function [rv] = main (argv) disp ("hello world"); rv = 0; return; endfunction main (argv); $ chmod a+x octave_program # add executable permissions $ ./octave_program hello world There's a

How to upgrade from Kohana 3.2 to 3.3 (implementing PSR-0)?

谁都会走 提交于 2019-12-01 00:57:58
What steps do I need tot take to upgrade from Kohana 3.2 to 3.3 with respect to the implementation of PSR-0 and what commands have to be executed from the command line? Daan Unix command line: These are the steps I took to implement PSR-0 in my Kohana application. I removed the following system/ dir: rm -rf system In your current bootstrap.php the only change is to make the classes start with an upper, so best is to keep your old bootstrap and just change the following lines on top of the file: // Load the core Kohana class require SYSPATH.'classes/Kohana/Core'.EXT; if (is_file(APPPATH.

'ng new my-app' error

让人想犯罪 __ 提交于 2019-12-01 00:55:52
I am trying to generate a new project and skeleton application using the latest version of Angular. I have tried uninstalling and reinstalling Angular CLI using: C:\>npm install -g @angular/cli@latest C:\>ng --version @angular/cli: 1.4.5 node: 8.8.1 os: win32 x64 This error occurs when trying to run 'ng new my-app' in command prompt: 'Error: The command "new" has an option without the required type and name field' Any help to resolve this issue is appreciated. This is a known issue and there is an issue raised in github for this. https://github.com/angular/angular-cli/issues/7984 Try below

Decode OpenSSL AES256 string in iOS

ぐ巨炮叔叔 提交于 2019-12-01 00:50:22
CLI $ echo -n "TEST1" | openssl enc -aes256 -k FUUU -nosalt -a bYbkQJcDFZt3y3UQEMbEeg== iOS NSString *leSYT = @"bYbkQJcDFZt3y3UQEMbEeg=="; NSData *data = [NSData dataFromBase64String:leSYT]; NSLog(@"%@",[data AES256DecryptWithKey:@"FUUU"]); iOS doesn't output anything since it failed. What am I missing? NSData additions: http://pastie.org/426530 // NSData+Base64 by Matt Gallagher The -k option in OpenSSL's enc utility derives an AES key and IV from your passphrase "FUUU". You can use the -p option to have OpenSSL print the AES256 key and IV that it derived: $ echo -n "TEST1" | openssl enc

How do I make a Ruby script using Trollop for command line parsing? [closed]

半世苍凉 提交于 2019-12-01 00:44:45
I've recently started using Trollop , a clean and elegant command line option parser for all my small Ruby-based command line hacks. I found it was really easy to use, but getting started was difficult: despite good online documentation, there wasn't anything that showed how to incorporate Trollop into a complete script. Q: How can I incorporate Trollop into my Ruby command-line program? A: Here is a self-contained example. The business with if __FILE__ == $0 isn't specific to Trollop; that just means "run the following code if this file is executed as a script". This technique allows you use

Execute a colorized command from a php script

被刻印的时光 ゝ 提交于 2019-11-30 23:45:06
问题 I have a command, for example 'git diff' that output a colorized result when I run it from the terminal. Now, I want to call that command from a CLI php script and display in the console the colorized result. I have try with exec(), system(), passthru() but in all case the output has been converted to plain black and white text. Is there a way to preserve the color of the standard result? If not, does someone know why this information get lost? 回答1: In all likelihood the command you are

How can I change the content-type of an object using aws cli?

…衆ロ難τιáo~ 提交于 2019-11-30 22:22:45
问题 I've got several objects stored in Amazon S3 whose content-type I need to change from text/html to application/rss+xml . I gather that it should be possible to do this with a copy command, specifying the same path for the source and destination. I'm trying to do this using the AWS cli tools, but I'm getting this error: $ aws s3 cp s3://mybucket/feed/ogg/index.html \ s3://mybucket/feed/ogg/index.html \ --content-type 'application/rss+xml' copy failed: s3://mybucket/feed/ogg/index.html to s3:/