I first looked at playing a media file with the following command:
am start -n com.android.music/com.android.music.MediaPlaybackActivity -d /sdcard/foo.mp3
That sorta works. It opens the media app and plays the file then immediately goes to the next song. Adding && sleep 1 && pkill com.android.music makes it work more like I wanted, but that's too ugly.
I ran across this post in the Tasker forum about invoking a task from the command line, but the consensus was that it wouldn't work unless the command line app has the right permissions.
But then I discovered that this works:
am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -e task_name YOUR_TASK_NAME
The only difference being the "-e" option instead of "-es."
So I made a simple script called "task" for the phone.
#! /system/bin/shNow I can bounce the command off the phone via ssh and run any Tasker task I want.
am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -e task_name "$*"